Package com.tonic.analysis.query.value
Interface Value
-
- All Known Implementing Classes:
Value.Absent,Value.BoolValue,Value.IntValue,Value.NullValue,Value.RealValue,Value.RegexValue,Value.SetValue,Value.StrValue,Value.TypeValue
public interface ValueThe universal scalar produced by attribute resolution and carried by query literals, as a closed set of nested variants discriminated bykind().
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classValue.Absentstatic classValue.BoolValuestatic classValue.IntValuestatic classValue.NullValuestatic classValue.RealValuestatic classValue.RegexValuestatic classValue.SetValuestatic classValue.StrValuestatic classValue.TypeValueA type reference: either an internal name (java/lang/String) or a descriptor (I).
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description ValueKindkind()static Valueof(boolean v)Wraps a flag, reusing the two shared instances.static Valueof(double v)Wraps a floating point number.static Valueof(long v)Wraps a whole number.static Valueof(String v)Wraps a string, mapping null onto the null value rather than failing.static ValueofNull()static ValueofRegex(Pattern pattern)Wraps a compiled pattern for use as the right-hand side of a match.static ValueofSet(List<Value> members)Wraps a member list for use as the right-hand side of a membership test.static ValueofType(String internalNameOrDescriptor)Wraps a type reference.
-
-
-
Field Detail
-
ABSENT
static final Value ABSENT
The sentinel for "could not be determined statically".
-
-
Method Detail
-
kind
ValueKind kind()
- Returns:
- the discriminator identifying which variant this is
-
of
static Value of(long v)
Wraps a whole number.- Parameters:
v- the number to wrap- Returns:
- an INT-kinded value
-
of
static Value of(double v)
Wraps a floating point number.- Parameters:
v- the number to wrap- Returns:
- a REAL-kinded value
-
of
static Value of(boolean v)
Wraps a flag, reusing the two shared instances.- Parameters:
v- the flag to wrap- Returns:
- a BOOL-kinded value
-
of
static Value of(String v)
Wraps a string, mapping null onto the null value rather than failing.- Parameters:
v- the string to wrap, may be null- Returns:
- a STRING-kinded value, or the NULL-kinded value when v is null
-
ofType
static Value ofType(String internalNameOrDescriptor)
Wraps a type reference.- Parameters:
internalNameOrDescriptor- an internal name such asjava/lang/String, or a descriptor such asI- Returns:
- a TYPE-kinded value
-
ofRegex
static Value ofRegex(Pattern pattern)
Wraps a compiled pattern for use as the right-hand side of a match.- Parameters:
pattern- the pattern to wrap- Returns:
- a REGEX-kinded value
-
ofSet
static Value ofSet(List<Value> members)
Wraps a member list for use as the right-hand side of a membership test.- Parameters:
members- the members, copied defensively- Returns:
- a SET-kinded value
-
ofNull
static Value ofNull()
- Returns:
- the shared NULL-kinded value
-
-