The operators of SpEL as plain functions: what an expression computes
for /, ==, <, + on text, and and the like, apart from the
tree that holds the operands.
The interpreter calls them for every operator, and so does the code the
generator writes when it compiles an expression to Dart, so both give
the same answer (7 / 2 is 3, 1 == 1.0, null < 1, 'a' + null
is a and the text null). Applications do not call them; they appear
in generated code. A function throws the SpelEvaluationException the
interpreter reports, without the expression and position the
interpreter adds to it.
// What the compiled form of `#a / #b` and `#a == #b` runs.
SpelOperations.divideInts(7, 2); // 3
SpelOperations.equals(1, 1.0); // true
SpelOperations.compare(null, 1) < 0; // true
SpelOperations.concat('n=', 1); // n=1
Spring (Java):
// The compiler mode of SpelExpression generates bytecode for them
// (OpDivide, OpEQ, OpLT, OpPlus, ...).
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
compare(
Object? l, Object? r, [TypeComparator comparator = const StandardTypeComparator()]) → int -
Negative, zero or positive as
lis less than, equal to or greater thanr, for<,<=,>and>=:nullcomes before everything, numbers compare by value, and values that cannot be ordered fail withSpelMessage.notComparable.comparatordecides, the standard one by default. -
concat(
Object? l, Object? r, {bool leftReal = false, bool rightReal = false, TypeConverter? typeConverter}) → String -
l + rwhen one side is a string: the other side is turned into text with text (leftRealandrightRealas in numeric). -
divide(
num l, num r, {bool leftReal = false, bool rightReal = false}) → num -
l / rfor numbers of which it is not known whether both are ints (see numeric, also forleftRealandrightReal). -
divideInts(
int l, int r) → int -
l / rfor two ints: truncating, and anUnsupportedErrorwhenris zero. -
doubleToString(
double value) → String -
Java's
Double.toStringofvalue, whattoString()of a real number gives:2.5, and7.0also where an integral double is anintat run time (the web, where Dart prints7). -
equals(
Object? l, Object? r, {TypeComparator comparator = const StandardTypeComparator(), bool isRealElement(Object collection, Object? key, Object? value)?}) → bool -
The
==of SpEL, also used by!=: numbers are equal by value (1 == 1.0), collections deeply (lists in order, sets and maps by content, with numbers inside compared like Java'sequals, so{2.0} == {2}isfalse), other values by==or, for comparable values of the same type,compareTo == 0, like Spring. -
join(
String l, String r) → String -
lfollowed byr, failing withSpelMessage.maxConcatenatedStringLengthExceededbeyondSpelLimits.maxConcatenatedStringLengthcharacters. -
listElement<
E> (List< E> list, int index) → E -
The element at
indexoflist, failing withSpelMessage.collectionIndexOutOfBoundsoutside it (also for a negativeindex), aslist[index]does. -
modulus(
num l, num r, {bool leftReal = false, bool rightReal = false}) → num -
l % rfor numbers of which it is not known whether both are ints (see numeric). -
modulusInts(
int l, int r) → int -
l % rfor two ints: the sign ofl, anUnsupportedErrorwhenris zero. -
modulusReals(
num l, num r) → double -
l % rwhen an operand is a real number: a double. -
numeric(
Operation operation, num l, num r, {bool leftReal = false, bool rightReal = false}) → num -
Applies the arithmetic
operationto two numbers. -
power(
num l, num r, {bool leftReal = false, bool rightReal = false}) → num -
l ^ rfor numbers of which it is not known whether both are ints (see numeric). -
powerInts(
int l, int r) → int -
l ^ rfor two ints: the power truncated to an int (or a long). -
powerReals(
num l, num r) → double -
l ^ rwhen an operand is a real number: a double. -
stringElement(
String text, int index) → String -
The character at
indexoftext, failing withSpelMessage.stringIndexOutOfBoundsoutside it, as'text'[index]does. -
text(
Object? value, {bool real = false, TypeConverter? typeConverter}) → String -
The text of
valueas the other side of a+on a string:nullis'null', a real number that is anintat run time (real) is Java's7.0, anything else is converted bytypeConverter(a list becomes1,2) and printed withtoStringwhen it cannot be. -
toBool(
Object? value, [TypeConverter? typeConverter]) → bool -
valueas aboolforand,or,!and the condition of? :: aboolas it is, anythingtypeConvertercan turn into one ('true') converted;nulland other values fail withSpelMessage.typeConversionError.