Package org.apache.groovy.json.internal
Interface Value
- All Known Implementing Classes:
CharSequenceValue,NumberValue,ValueContainer
public interface Value
Represents a lazily decoded JSON token or container managed by the index-overlay parser.
-
Method Summary
Modifier and TypeMethodDescriptionConverts this token to aBigDecimal.Converts this token to aBigInteger.booleanConverts this token to a boolean value.byteConverts this token to a byte value.charConverts this token to a single character.voidchop()Copies any shared backing buffer into a dedicated slice.Converts this token to aDate.doubleConverts this token to a double value.floatConverts this token to a float value.intintValue()Converts this token to an int value.booleanIndicates whether this value wraps a map or a collection.longConverts this token to a long value.shortConverts this token to a short value.Returns the string form using the value's configured decoding policy.Returns the fully decoded string form.<T extends Enum>
TConverts this token to an enum constant.toValue()Materializes this token as a regular Java value.
-
Method Details
-
byteValue
byte byteValue()Converts this token to a byte value.- Returns:
- the byte representation
-
shortValue
short shortValue()Converts this token to a short value.- Returns:
- the short representation
-
intValue
int intValue()Converts this token to an int value.- Returns:
- the int representation
-
longValue
long longValue()Converts this token to a long value.- Returns:
- the long representation
-
bigDecimalValue
BigDecimal bigDecimalValue()Converts this token to aBigDecimal.- Returns:
- the decimal representation
-
bigIntegerValue
BigInteger bigIntegerValue()Converts this token to aBigInteger.- Returns:
- the integer representation
-
floatValue
float floatValue()Converts this token to a float value.- Returns:
- the float representation
-
doubleValue
double doubleValue()Converts this token to a double value.- Returns:
- the double representation
-
booleanValue
boolean booleanValue()Converts this token to a boolean value.- Returns:
- the boolean representation
-
dateValue
Date dateValue()Converts this token to aDate.- Returns:
- the date representation
-
stringValue
String stringValue()Returns the string form using the value's configured decoding policy.- Returns:
- the string representation
-
stringValueEncoded
String stringValueEncoded()Returns the fully decoded string form.- Returns:
- the decoded string representation
-
toValue
Object toValue()Materializes this token as a regular Java value.- Returns:
- the hydrated value
-
toEnum
Converts this token to an enum constant.- Type Parameters:
T- enum type- Parameters:
cls- enum type to resolve- Returns:
- the resolved enum constant
-
isContainer
boolean isContainer()Indicates whether this value wraps a map or a collection.- Returns:
truefor container values
-
chop
void chop()Copies any shared backing buffer into a dedicated slice. -
charValue
char charValue()Converts this token to a single character.- Returns:
- the leading character representation
-