Java Code Examples for org.springframework.expression.spel.SpelMessage#NOT_AN_INTEGER

The following examples show how to use org.springframework.expression.spel.SpelMessage#NOT_AN_INTEGER . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring4-understanding   File: Tokenizer.java    License: Apache License 2.0 6 votes vote down vote up
private void pushHexIntToken(char[] data, boolean isLong, int start, int end) {
	if (data.length == 0) {
		if (isLong) {
			throw new InternalParseException(new SpelParseException(this.expressionString,
					start, SpelMessage.NOT_A_LONG, this.expressionString.substring(start,
							end + 1)));
		}
		else {
			throw new InternalParseException(new SpelParseException(this.expressionString,
					start, SpelMessage.NOT_AN_INTEGER, this.expressionString.substring(
							start, end)));
		}
	}
	if (isLong) {
		this.tokens.add(new Token(TokenKind.LITERAL_HEXLONG, data, start, end));
	}
	else {
		this.tokens.add(new Token(TokenKind.LITERAL_HEXINT, data, start, end));
	}
}
 
Example 2
Source Project: spring-analysis-note   File: Literal.java    License: MIT License 5 votes vote down vote up
/**
 * Process the string form of a number, using the specified base if supplied
 * and return an appropriate literal to hold it. Any suffix to indicate a
 * long will be taken into account (either 'l' or 'L' is supported).
 * @param numberToken the token holding the number as its payload (eg. 1234 or 0xCAFE)
 * @param radix the base of number
 * @return a subtype of Literal that can represent it
 */
public static Literal getIntLiteral(String numberToken, int startPos, int endPos, int radix) {
	try {
		int value = Integer.parseInt(numberToken, radix);
		return new IntLiteral(numberToken, startPos, endPos, value);
	}
	catch (NumberFormatException ex) {
		throw new InternalParseException(new SpelParseException(startPos, ex, SpelMessage.NOT_AN_INTEGER, numberToken));
	}
}
 
Example 3
Source Project: java-technology-stack   File: Literal.java    License: MIT License 5 votes vote down vote up
/**
 * Process the string form of a number, using the specified base if supplied
 * and return an appropriate literal to hold it. Any suffix to indicate a
 * long will be taken into account (either 'l' or 'L' is supported).
 * @param numberToken the token holding the number as its payload (eg. 1234 or 0xCAFE)
 * @param radix the base of number
 * @return a subtype of Literal that can represent it
 */
public static Literal getIntLiteral(String numberToken, int pos, int radix) {
	try {
		int value = Integer.parseInt(numberToken, radix);
		return new IntLiteral(numberToken, pos, value);
	}
	catch (NumberFormatException ex) {
		throw new InternalParseException(new SpelParseException(pos>>16, ex, SpelMessage.NOT_AN_INTEGER, numberToken));
	}
}
 
Example 4
Source Project: lams   File: Literal.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Process the string form of a number, using the specified base if supplied
 * and return an appropriate literal to hold it. Any suffix to indicate a
 * long will be taken into account (either 'l' or 'L' is supported).
 * @param numberToken the token holding the number as its payload (eg. 1234 or 0xCAFE)
 * @param radix the base of number
 * @return a subtype of Literal that can represent it
 */
public static Literal getIntLiteral(String numberToken, int pos, int radix) {
	try {
		int value = Integer.parseInt(numberToken, radix);
		return new IntLiteral(numberToken, pos, value);
	}
	catch (NumberFormatException ex) {
		throw new InternalParseException(new SpelParseException(pos>>16, ex, SpelMessage.NOT_AN_INTEGER, numberToken));
	}
}
 
Example 5
Source Project: spring4-understanding   File: Literal.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Process the string form of a number, using the specified base if supplied
 * and return an appropriate literal to hold it. Any suffix to indicate a
 * long will be taken into account (either 'l' or 'L' is supported).
 * @param numberToken the token holding the number as its payload (eg. 1234 or 0xCAFE)
 * @param radix the base of number
 * @return a subtype of Literal that can represent it
 */
public static Literal getIntLiteral(String numberToken, int pos, int radix) {
	try {
		int value = Integer.parseInt(numberToken, radix);
		return new IntLiteral(numberToken, pos, value);
	}
	catch (NumberFormatException ex) {
		throw new InternalParseException(new SpelParseException(pos>>16, ex, SpelMessage.NOT_AN_INTEGER, numberToken));
	}
}