Class Value
- All Implemented Interfaces:
Cloneable
Note:
Please note that conversion of a Value and a VSField is done in different manners. The VSField can use its Field Actors to perform a conversion that is more accurate than the conversion using the Value methods toNnnn(), e.g. to convert an Integer into a String that could be "green", "red" or "blue", and vice-versa.
The Value class also provides additional conversion routines to Java Date, SQL Date/Time/Timestamp and GregorianCalendar.
This class is immutable and thread-safe.
The data value types are closely related the JDBC and XML data types as follows:
Conversion from SQL or Java to IIZI
SQL Type Java type Type -------------------------- -------------------- ------------------ CHAR String String VARCHAR String String LONGVARCHAR String String NUMERIC java.math.BigDecimal Decimal DECIMAL java.math.BigDecimal Decimal BIT Boolean Boolean TINYINT Byte Byte SMALLINT Short Short INTEGER Integer Integer BIGINT Long Long REAL Float Float FLOAT Double Double DOUBLE Double Double BINARY byte[] Binary VARBINARY byte[] Binary LONGVARBINARY byte[] Binary DATE LocalDate LocalDate TIME LocalTime LocaleTime TIME WITH TIMEZONE OffsetTime OffsetTime TIMESTAMP LocalDateTime LocalDateTime TIMESTAMP WITH TIMEZONE OffsetDateTime OffsetDateTime
Conversion from IIZI to Java or SQL
Type Java Type SQL type ---------------- -------------------- -------------------------- String String VARCHAR or LONGVARCHAR Decimal java.math.BigDecimal NUMERIC Boolean Boolean BIT Byte Byte TINYINT Short Short SMALLINT Integer Integer INTEGER Long Long BIGINT Float Float REAL Double Double DOUBLE Binary byte[] VARBINARY or LONGVARBINARY LocalDate LocalDate DATE LocalTime LocalTime TIME OffsetTime OffsetTime TIME (in the system time zone) LocalDateTime LocalDateTime TIMESTAMP OffsetDateTime OffsetDateTime TIMESTAMP WITH TIMEZONE or TIMESTAMP (in system time zone) ZonedDateTime ZonedDateTime TIMESTAMP WITH TIMEZONE or TIMESTAMP (in system time zone)
This implementation allows display of the calendars Thai Buddhist, Japanese Imperial (Meiji, Taisho, Showa, Heisei).
- Author:
- Christopher Mindus
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe enumeration of Categories.static enumThe enumeration of Types.Field Summary
FieldsModifier and TypeFieldDescriptionfinal Value.TypeThe type of this value.final ObjectThe Object of the value in its native format.Constructor Summary
ConstructorsConstructorDescriptionValue(boolean value) Constructs a Boolean value.Value(byte value) Constructs a Byte value.Value(byte[] value) Constructs a Binary value.Value(double value) Constructs a Double value.Value(float value) Constructs a Float value.Value(int value) Constructs a Integer value.Value(long value) Constructs a Long value.Value(short value) Constructs a Short value.Constructs a KString value.Constructs an ImmutableXMLGregorianCalendar value.Constructs a Boolean value.Constructs a Byte value.Constructs a Double value.Constructs a Float value.Constructs a Integer value.Constructs a Long value.Constructs a Value object from the Java native representation.Constructs a Short value.Constructs a String value.Value(BigDecimal value) Constructs a Decimal value.Constructs a Duration value.Constructs a LocalDate value.Value(LocalDateTime value) Constructs a LocalDateTime value.Constructs a LocalTime value.Constructs a MonthDay value.Value(OffsetDateTime value) Constructs a OffsetDateTime value.Value(OffsetTime value) Constructs an OffsetTime value.Constructs a Period value.Constructs a Year value.Constructs a YearMonth value.Value(ZonedDateTime value) Constructs a ZonedDateTime value.Constructs a value from an XML Duration.Value(XMLGregorianCalendar value) Creates an immutable XMLGregorianCalendar value.Constructs the Value from an Element.Method Summary
Modifier and TypeMethodDescriptionadjust(TemporalAdjuster temporalAdjuster) Adjusts the current temporal value with a temporal adjuster.clone()Clones the value.convert(Value.Type targetType) Converts this Value from its current value type to the requested target type using the locale looked-up from current thread or if not found, for system default.convert(Value.Type targetType, LocaleInfo localeInfo) Converts this Value from its current value type to the requested target type using the specified locale information.voiddispose()Disposes of the value.booleanChecks if two values are equal; the type must match as well as the value.booleanChecks if two values are equal; the value (optionally converted) must match.static booleanChecks if two Value's are equal, also being null.static booleanChecks if two Value's are equal, also being null.booleanChecks if two values are equal; the type must match as well as the value.static ValuefromCalendar(Calendar calendar) Creates a ZonedDateTime value from a Calendar.static ValueCreates a Value from an XMLGregorianCalendar depending on the datatype:static ValuefromDurationInMillis(Number millis) Creates a duration from a numeric value in milliseconds.static ValuefromLocalDate(long millis) Constructs a LocaleDate value.static ValuefromLocalDate(Date date) Constructs a LocalDate value from an SQL date.static ValuefromLocalDate(Date date) Constructs a Date value.static ValuefromLocalDateTime(long millis) Constructs LocalDateTime from milliseconds since Java epoch value.static ValuefromLocalDateTime(Timestamp timestamp) Constructs a LocalDateTime from a Timestamp value.static ValuefromLocalDateTime(Date dateAndTime) Constructs a LocalDateTime from a Date (and time) value.static ValuefromLocalTime(long millis) Constructs a Time value.static ValuefromLocalTime(Time time) Constructs a Time value.static ValuefromLocalTime(Date time) Constructs a Time value.static ValuegetDefaultValue_StringFallback(Value.Type type, boolean isNullAllowed) Safely gets a shared instance of anullor defaultValueof the specified type depending on theisNullAllowedflag.intgetScale()Get the scale of this value.intGets the default SQL type for this Value type.static StringgetSQLTypeName(int sqlType) Returns the String of the given SQLTypesvalue.static StringgetString(Object value, Value.Type type, String pattern, LocaleInfo localeInfo) Gets the value as a String with the specified pattern formatter string.getString(String pattern, LocaleInfo localeInfo) Gets the value as a String with the specified pattern formatter string.static Value.TypeReturns the Value Type from a given type string.Gets the type string.static Value.TypegetValueType(Object value) Guesses the type value for a Value class.static DatatypeFactoryGets the XML datatype factory.static Value.TypeGuesses the value type from a String in the following order: Long, Double, BigDecimal, ZonedDateTime, OffsetDateTime, LocalDateTime, OffsetTime, LocalTime, LocalDate, Period, Duration, MonthDay, YearMonth, Boolean.inthashCode()Hash code.voidinitialize(Element element) Initializes an XML element from this value.booleanisNull()Checks if the value is NULL.static booleanisTypeClassValid(String classFQN) Checks if a fully qualified name is valid as type.static ValueTries to create aValueinstance with a type forced to the default SQL Type mapping.static ValueofType(Object value, Value.Type targetType, LocaleInfo localeInfo) Tries to create aValueinstance forced to the specified type.static ValueparseValue(String value, Value.Type type, String pattern, LocaleInfo localeInfo) Creates a Value object from a String using a specified pattern and locale.Converts this Value and returns it as aBigDecimalusing the locale looked-up from current thread or if not found, for system default.Converts this Value and returns it as aBigIntegerusing the locale looked-up from current thread or if not found, for system default.byte[]toBinary()Converts this Value and returns it as a Binarybyte []using the locale looked-up from current thread or if not found, for system default.Converts this Value and returns it as aBooleanusing the locale looked-up from current thread or if not found, for system default.toByte()Converts this Value and returns it as aByteusing the locale looked-up from current thread or if not found, for system default.toDate()Converts all date/time formats intojava.util.Date.toDouble()Converts this Value and returns it as aDoubleusing the locale looked-up from current thread or if not found, for system default.Converts this Value and returns it as aDurationusing the locale looked-up from current thread or if not found, for system default.toFloat()Converts this Value and returns it as aFloatusing the locale looked-up from current thread or if not found, for system default.Converts all date/time formats intoGregorianCalendar.Converts this Value and returns it as anIntegerusing the locale looked-up from current thread or if not found, for system default.Converts this Value and returns it as aKStringusing the locale looked-up from current thread or if not found, for system default.Converts this Value and returns it as aLocalDateusing the locale looked-up from current thread or if not found, for system default.Converts this Value and returns it as aLocalDateTimeusing the locale looked-up from current thread or if not found, for system default.toLocalDateTime(LocaleInfo localeInfo) Converts this Value and returns it as aLocalDateTimeusing the locale information specified.Converts this Value and returns it as aLocalTimeusing the locale looked-up from current thread or if not found, for system default.toLong()Converts this Value and returns it as aLongusing the locale looked-up from current thread or if not found, for system default.Converts this Value and returns it as aMonthDayusing the locale looked-up from current thread or if not found, for system default.Converts this Value and returns it as anOffsetDateTimeusing the locale looked-up from current thread or if not found, for system default.toOffsetDateTime(LocaleInfo localeInfo) Converts this Value and returns it as anOffsetDateTimeusing the locale information specified.Converts this Value and returns it as anOffsetTimeusing the locale looked-up from current thread or if not found, for system default.toOffsetTime(LocaleInfo localeInfo) Converts this Value and returns it as anOffsetTimeusing the locale information specified.toPeriod()Converts this Value and returns it as aPeriodusing the locale looked-up from current thread or if not found, for system default.toShort()Converts this Value and returns it as aShortusing the locale looked-up from current thread or if not found, for system default.Converts all date/time formats intojava.sql.Date.Converts all date/time formats intojava.sql.Time.Converts all date/time formats intojava.sql.Timestamp.toString()Converts this Value and returns it as aStringusing the locale looked-up from current thread or if not found, for system default.Produces a debug/logging string of the value (including the type).Converts this Value and returns it as ajavax.xml.datatype.Durationusing the locale looked-up from current thread or if not found, for system default.Converts this Value and returns it as anImmutableXMLGregorianCalendarusing the locale looked-up from current thread or if not found, for system default.toXMLGregorianCalendar(LocaleInfo localeInfo) Converts this Value and returns it as anImmutableXMLGregorianCalendarusing the locale information specified.toYear()Converts this Value and returns it as aYearusing the locale looked-up from current thread or if not found, for system default.Converts this Value and returns it as aYearMonthusing the locale looked-up from current thread or if not found, for system default.Converts this Value and returns it as aZonedDateTimeusing the locale looked-up from current thread or if not found, for system default.toZonedDateTime(LocaleInfo localeInfo) Converts this Value and returns it as aZonedDateTimeusing the locale information specified.static Value.TypetypeFromSQLType(int sqlType) Convenience method to convert SQL types to the default mapped value type.
Field Details
type
The type of this value.value
The Object of the value in its native format.
Constructor Details
Value
Constructs the Value from an Element.- Parameters:
element- The element.- Throws:
Exception- If the value could not be loaded from the element.
Value
Constructs a Value object from the Java native representation. If thevalueparameter is null, it is assumed to be a java.lang.String.The supported object types are the value classes defined by the Type's.
- Parameters:
value- The native value, not null.- Throws:
IllegalArgumentException- if the native form doesn't match what is expected.NullPointerException- if the value is null.
Value
Constructs a String value.- Parameters:
value- The value.
Value
Constructs a KString value.- Parameters:
value- The value.
Value
public Value(boolean value) Constructs a Boolean value.- Parameters:
value- The value.
Value
Constructs a Boolean value.- Parameters:
value- The value.
Value
public Value(byte value) Constructs a Byte value.- Parameters:
value- The value.
Value
Constructs a Byte value.- Parameters:
value- The value.
Value
Constructs a Decimal value.- Parameters:
value- The value.
Value
public Value(short value) Constructs a Short value.- Parameters:
value- The value.
Value
Constructs a Short value.- Parameters:
value- The value.
Value
public Value(int value) Constructs a Integer value.- Parameters:
value- The value.
Value
Constructs a Integer value.- Parameters:
value- The value.
Value
public Value(long value) Constructs a Long value.- Parameters:
value- The value.
Value
Constructs a Long value.- Parameters:
value- The value.
Value
public Value(float value) Constructs a Float value.- Parameters:
value- The value.
Value
Constructs a Float value.- Parameters:
value- The value.
Value
public Value(double value) Constructs a Double value.- Parameters:
value- The value.
Value
Constructs a Double value.- Parameters:
value- The value.
Value
Constructs a LocalTime value.- Parameters:
value- The value.
Value
Constructs an OffsetTime value.- Parameters:
value- The value.
Value
Constructs a LocalDate value.- Parameters:
value- The value.
Value
Constructs a MonthDay value.- Parameters:
value- The value.
Value
Constructs a Year value.- Parameters:
value- The value.
Value
Constructs a YearMonth value.- Parameters:
value- The value.
Value
Constructs a LocalDateTime value.- Parameters:
value- The value.
Value
Constructs a OffsetDateTime value.- Parameters:
value- The value.
Value
Constructs a ZonedDateTime value.- Parameters:
value- The value.
Value
Constructs an ImmutableXMLGregorianCalendar value.- Parameters:
value- The value.
Value
Creates an immutable XMLGregorianCalendar value.- Parameters:
value- The XMLGregorianCalendar value.
Value
Constructs a Duration value.- Parameters:
value- The value.
Value
Constructs a Period value.- Parameters:
value- The value.
Value
Constructs a value from an XML Duration.- Parameters:
value- The value.
Value
public Value(byte[] value) Constructs a Binary value.- Parameters:
value- The value.
Method Details
getSQLTypeName
Returns the String of the given SQLTypesvalue.- Parameters:
sqlType- The SQLTypesvalue.- Returns:
- The String representation, or "unknown[sqlType]".
getType
Returns the Value Type from a given type string.- Parameters:
type- The String representation of the Type.- Returns:
- The Type, or null if not a valid type.
isTypeClassValid
Checks if a fully qualified name is valid as type.- Parameters:
classFQN- Class name such as "java.lang.String".- Returns:
- Type validity flag.
getValueType
Guesses the type value for a Value class.- Parameters:
value- The value.- Returns:
- The type, or null if it fails or value is null.
ofType
Tries to create aValueinstance forced to the specified type. The value is converted from the supported conversion objects that are specific to the type in question using it'sconvertmethod, i.e. callingValue.Type.valueObjectmethodIValueObject.convert(Object,Value.Type,LocaleInfo).This method is used e.g. when converting values from SQL data types to a requested Value.Type.
- Parameters:
value- The value as a Java object, possibly null.targetType- The target value type to enforce.localeInfo- The locale information, null to look-up from current thread or if not found, for system default.- Returns:
- a
Valueinstance of the specified type ornullif conversion failed.
getDefaultValue_StringFallback
Safely gets a shared instance of anullor defaultValueof the specified type depending on theisNullAllowedflag. No exception is thrown if the type is invalid, as theT_Stringtype is assumed instead.- Parameters:
type- The value type. If the value type is null,Value.Type.Stringis assumed.isNullAllowed- If null is allowed or not.- Returns:
- The default or
null Valueof the value type.
typeFromSQLType
Convenience method to convert SQL types to the default mapped value type.- Parameters:
sqlType- the SQL type- Returns:
- The default mapped value Type, or null if not found.
ofSQLType
Tries to create aValueinstance with a type forced to the default SQL Type mapping.- Parameters:
value- The value as a java objectsqlType- the SQL Type to enforce- Returns:
- a
Valueinstance of the implied type. (default mapping of the SQL type) ornullif conversion failed.
getXMLDataFactory
Gets the XML datatype factory.- Returns:
- The XML datatype factory singleton.
guessType
Guesses the value type from a String in the following order:- Long,
- Double,
- BigDecimal,
- ZonedDateTime,
- OffsetDateTime,
- LocalDateTime,
- OffsetTime,
- LocalTime,
- LocalDate,
- Period,
- Duration,
- MonthDay,
- YearMonth,
- Boolean.
- Parameters:
value- The value.- Returns:
- The type matching, or
Type.Stringin worst case for no match.
fromLocalTime
Constructs a Time value.- Parameters:
millis- milliseconds since January 1, 1970, 00:00:00 GMT; a negative number is milliseconds before January 1, 1970, 00:00:00 GMT, or the Java epoch.- Returns:
- A new Value with LocalTime type.
fromLocalTime
Constructs a Time value.- Parameters:
time- A time object as java.util.Date or java.sql.Time.- Returns:
- A new Value with LocalTime type.
fromLocalTime
Constructs a Time value.- Parameters:
time- A time object as java.util.Date or java.sql.Time.- Returns:
- A new Value with LocalTime type.
fromLocalDate
Constructs a LocaleDate value.- Parameters:
millis- milliseconds since January 1, 1970, 00:00:00 GMT; a negative number is milliseconds before January 1, 1970, 00:00:00 GMT- Returns:
- A new value.
fromLocalDate
Constructs a LocalDate value from an SQL date.- Parameters:
date- The SQL date.- Returns:
- a new LocalDate value.
fromLocalDate
Constructs a Date value.- Parameters:
date- The "Java" Date.- Returns:
- a new LocalDate value.
fromLocalDateTime
Constructs LocalDateTime from milliseconds since Java epoch value.- Parameters:
millis- milliseconds since January 1, 1970, 00:00:00 GMT; a negative number is milliseconds before January 1, 1970, 00:00:00 GMT- Returns:
- A Value with LocalDateTime as type.
fromLocalDateTime
Constructs a LocalDateTime from a Timestamp value.- Parameters:
timestamp- The timestamp value.- Returns:
- A Value with LocalDateTime as type.
fromLocalDateTime
Constructs a LocalDateTime from a Date (and time) value.- Parameters:
dateAndTime- The date/time value.- Returns:
- A Value with LocalDateTime as type.
fromCalendar
Creates a ZonedDateTime value from a Calendar.- Parameters:
calendar- The calendar instance, can also be a GregorianCalendar instance.- Returns:
- A Value with ZonedDateTime type.
fromDateBasedValue
Creates a Value from an XMLGregorianCalendar depending on the datatype:- Parameters:
xcal- The XML Gregorian Calendar that is used for parsing the gXXX datatypes for XML Schema.- Returns:
- A Value with the type as described above.
- Throws:
DateTimeException- If the value of any field is out of rangeIllegalStateException- If the combination of set fields does not match one of the eight defined XML Schema built-in date/time datatypes.
fromDurationInMillis
Creates a duration from a numeric value in milliseconds.- Parameters:
millis- A duration value in milliseconds.- Returns:
- The new value.
initialize
Initializes an XML element from this value. There is no support for a null value when saving from XML.- Parameters:
element- Element to store the value in.- Throws:
Exception- If the value could not be saved.
isNull
public boolean isNull()Checks if the value is NULL.- Returns:
- true if the value object is null, otherwise false.
getTypeString
Gets the type string.- Returns:
- The type string.
toStringWithType
Produces a debug/logging string of the value (including the type).- Returns:
- The string formatted as "
Type[value]".
equals
Checks if two values are equal; the type must match as well as the value. Two values that are null must match the type.equals
Checks if two values are equal; the value (optionally converted) must match. Two values that are null must (optionally) match the type.- Parameters:
v- The value to compare with.ignoreType- Perform value conversion if needed when set totrue.- Returns:
- The equality flag.
equals
Checks if two values are equal; the type must match as well as the value. Two values that are null must match the type.- Parameters:
v- The value to compare with.- Returns:
- The equality flag.
equals
Checks if two Value's are equal, also being null. Optionally ignore type.- Parameters:
v1- The first value.v2- The second value.ignoreType- Perform value conversion if needed when set totrue.- Returns:
- true if both values are equal.
equals
Checks if two Value's are equal, also being null. The type must match as well as the value- Parameters:
v1- The first value.v2- The second value.- Returns:
- true if both values are equal.
clone
Clones the value.- Overrides:
clonein classObject- Returns:
- Value for the clone instance: the same value is returned because they are invariant/immutable, i.e.
thisinstance is returned when the value is NOT a KString value. If the value is of KString type and not null, the return value is a cloned instance, i.e. a new instance of a Value with a cloned KString value.
dispose
public void dispose()Disposes of the value. This method has no affect on non-KString values. The values are cleaned up later in garbage collection anyway, but please bear in mind that KString may have references to other properties and disposing the value will clean it up quicker.hashCode
public int hashCode()Hash code.getString
Gets the value as a String with the specified pattern formatter string. This pattern formatter string depends on the value type.- Parameters:
pattern- The pattern for the formatter. If the pattern isnull, a default formatter is used.localeInfo- The locale information ornullfor default locale.- Returns:
- The formatted value as a String. If the value is
null, the return value will benull. - Throws:
IllegalArgumentException- If the pattern is in error.
getString
public static String getString(Object value, Value.Type type, String pattern, LocaleInfo localeInfo) throws IllegalArgumentException Gets the value as a String with the specified pattern formatter string. This pattern formatter string depends on the value type.- Parameters:
value- The value.type- The value type.pattern- The pattern for the formatter. If the pattern isnull, a default formatter is used.localeInfo- The locale information ornullfor default locale.- Returns:
- The formatted value as a String. If the value is
null, the return value will benull. - Throws:
IllegalArgumentException- If the pattern is in error.
parseValue
public static Value parseValue(String value, Value.Type type, String pattern, LocaleInfo localeInfo) throws ParseException, IllegalArgumentException Creates a Value object from a String using a specified pattern and locale. If the value is null, the Value will have a also null value, but return a Value Object.- Parameters:
value- The value, can benull.type- The type for the value.pattern- The pattern for the parser. If the pattern isnull, a default parser is used.localeInfo- The locale information ornullfor default locale.- Returns:
- A value object, never null.
- Throws:
ParseException- For parsing errors.IllegalArgumentException- If the pattern is invalid.
getSQLType
public int getSQLType()Gets the default SQL type for this Value type.- Returns:
- the SQL type, or
Types.JAVA_OBJECTif no JDBC mapping is present.
getScale
public int getScale()Get the scale of this value. Only interesting for BigDecimal.- Returns:
- The scale.
convert
Converts this Value from its current value type to the requested target type using the locale looked-up from current thread or if not found, for system default.- Parameters:
targetType- The target type requested.- Returns:
- The converted value as a new instance.
- Throws:
ParseException- Thrown when conversion is not possible or a parsing error occurs.
convert
Converts this Value from its current value type to the requested target type using the specified locale information.- Parameters:
targetType- The target type requested.localeInfo- The locale information, null to look-up from current thread or if not found, for system default.- Returns:
- The converted value as a new instance.
- Throws:
ParseException- Thrown when conversion is not possible or a parsing error occurs.
toString
Converts this Value and returns it as aStringusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
KStringformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.toKString
Converts this Value and returns it as aKStringusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
KStringformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
KString, ornullif the Value isnull.
toBoolean
Converts this Value and returns it as aBooleanusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
Booleanformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
Boolean, ornullif the Value isnull.
toByte
Converts this Value and returns it as aByteusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
Byteformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
Byte, ornullif the Value isnull.
toShort
Converts this Value and returns it as aShortusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
Shortformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
Short, ornullif the Value isnull.
toInteger
Converts this Value and returns it as anIntegerusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
Integerformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
Integer, ornullif the Value isnull.
toLong
Converts this Value and returns it as aLongusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
Longformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
Long, ornullif the Value isnull.
toFloat
Converts this Value and returns it as aFloatusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
Floatformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
Float, ornullif the Value isnull.
toDouble
Converts this Value and returns it as aDoubleusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
Doubleformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
Double, ornullif the Value isnull.
toBigInteger
Converts this Value and returns it as aBigIntegerusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
BigIntegerformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
BigInteger, ornullif the Value isnull.
toBigDecimal
Converts this Value and returns it as aBigDecimalusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
BigDecimalformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
BigDecimal, ornullif the Value isnull.
toLocalTime
Converts this Value and returns it as aLocalTimeusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
LocalTimeformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
LocalTime, ornullif the Value isnull.
toOffsetTime
Converts this Value and returns it as anOffsetTimeusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
OffsetTimeformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
OffsetTime, ornullif the Value isnull.
toOffsetTime
Converts this Value and returns it as anOffsetTimeusing the locale information specified.If this Value already is in a
OffsetTimeformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Parameters:
localeInfo- The locale information, null to look-up from current thread or if not found, for system default.- Returns:
- The value as a
OffsetTime, ornullif the Value isnull.
toLocalDate
Converts this Value and returns it as aLocalDateusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
LocalDateformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
LocalDate, ornullif the Value isnull.
toMonthDay
Converts this Value and returns it as aMonthDayusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
MonthDayformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
MonthDay, ornullif the Value isnull.
toYear
Converts this Value and returns it as aYearusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
Yearformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
Year, ornullif the Value isnull.
toYearMonth
Converts this Value and returns it as aYearMonthusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
YearMonthformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
YearMonth, ornullif the Value isnull.
toLocalDateTime
Converts this Value and returns it as aLocalDateTimeusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
LocalDateTimeformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
LocalDateTime, ornullif the Value isnull.
toLocalDateTime
Converts this Value and returns it as aLocalDateTimeusing the locale information specified.If this Value already is in a
LocalDateTimeformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Parameters:
localeInfo- The locale information, null to look-up from current thread or if not found, for system default.- Returns:
- The value as a
LocalDateTime, ornullif the Value isnull.
toOffsetDateTime
Converts this Value and returns it as anOffsetDateTimeusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
OffsetDateTimeformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
OffsetDateTime, ornullif the Value isnull.
toOffsetDateTime
Converts this Value and returns it as anOffsetDateTimeusing the locale information specified.If this Value already is in a
OffsetDateTimeformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Parameters:
localeInfo- The locale information, null to look-up from current thread or if not found, for system default.- Returns:
- The value as a
OffsetDateTime, ornullif the Value isnull.
toZonedDateTime
Converts this Value and returns it as aZonedDateTimeusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
ZonedDateTimeformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
ZonedDateTime, ornullif the Value isnull.
toZonedDateTime
Converts this Value and returns it as aZonedDateTimeusing the locale information specified.If this Value already is in a
ZonedDateTimeformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Parameters:
localeInfo- The locale information, null to look-up from current thread or if not found, for system default.- Returns:
- The value as a
ZonedDateTime, ornullif the Value isnull.
toXMLGregorianCalendar
Converts this Value and returns it as anImmutableXMLGregorianCalendarusing the locale looked-up from current thread or if not found, for system default.If this Value already is in an
ImmutableXMLGregorianCalendarformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as an
XMLGregorianCalendar, ornullif the Value isnull.
toXMLGregorianCalendar
Converts this Value and returns it as anImmutableXMLGregorianCalendarusing the locale information specified.If this Value already is in an
ImmutableXMLGregorianCalendarformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Parameters:
localeInfo- The locale information, null to look-up from current thread or if not found, for system default.- Returns:
- The value as an
XMLGregorianCalendar, ornullif the Value isnull.
toDuration
Converts this Value and returns it as aDurationusing the locale looked-up from current thread or if not found, for system default.If this Value already is in an
Durationformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
Duration, ornullif the Value isnull.
toPeriod
Converts this Value and returns it as aPeriodusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
Periodformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
Period, ornullif the Value isnull.
toXMLDuration
Converts this Value and returns it as ajavax.xml.datatype.Durationusing the locale looked-up from current thread or if not found, for system default.If this Value already is in a
javax.xml.datatype.Durationformat, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a
javax.xml.datatype.Duration, ornullif the Value isnull.
toBinary
public byte[] toBinary()Converts this Value and returns it as a Binarybyte []using the locale looked-up from current thread or if not found, for system default.If this Value already is in a
byte []format, the value is returned directly.If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead.- Returns:
- The value as a Binary
byte [], ornullif the Value isnull.
toDate
Converts all date/time formats intojava.util.Date. Many other Value's can be converted to date/time formats by using the conversion of a number of milliseconds from the Epoch (January 1st 1970 00:00:00 UTC) to a date. This includes all numbers and duration/periods.The conversion is done silently and you may experience loss of precision.
If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead. Then you convert the native date/time Value type to ajava.util.Date.- Returns:
- The Value as a
java.util.Dateif possible,nullif Value isnullor conversion fails.
toSQLTimestamp
Converts all date/time formats intojava.sql.Timestamp. Many other Value's can be converted to date/time formats by using the conversion of a number of milliseconds from the Epoch (January 1st 1970 00:00:00 UTC) to a date. This includes all numbers and duration/periods.The conversion is done silently and you may experience loss of precision.
If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead. Then you convert the native date/time Value type to ajava.sql.Timestamp.- Returns:
- The Value as a
java.sql.Timestampif possible,nullif Value isnullor conversion fails.
toSQLTime
Converts all date/time formats intojava.sql.Time. Many other Value's can be converted to date/time formats by using the conversion of a number of milliseconds from the Epoch (January 1st 1970 00:00:00 UTC) to a date. This includes all numbers and duration/periods.The conversion is done silently and you may experience loss of precision.
If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead. Then you convert the native date/time Value type to ajava.sql.Time.- Returns:
- The Value as a
java.sql.Timeif possible,nullif Value isnullor conversion fails.
toSQLDate
Converts all date/time formats intojava.sql.Date. Many other Value's can be converted to date/time formats by using the conversion of a number of milliseconds from the Epoch (January 1st 1970 00:00:00 UTC) to a date. This includes all numbers and duration/periods.The conversion is done silently and you may experience loss of precision.
If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead. Then you convert the native date/time Value type to ajava.sql.Date.- Returns:
- The Value as a
java.sql.Dateif possible,nullif Value isnullor conversion fails.
toGregorianCalendar
Converts all date/time formats intoGregorianCalendar. Many other Value's can be converted to date/time formats by using the conversion of a number of milliseconds from the Epoch (January 1st 1970 00:00:00 UTC) to a date. This includes all numbers and duration/periods.The conversion is done silently and you may experience loss of precision.
If the conversion cannot be done, it is silently returning
nullwithout logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, useconvert(Type)or orconvert(Type, LocaleInfo)instead. Then you convert the native date/time Value type to ajava.sql.Date.- Returns:
- The Value as a
GregorianCalendarif possible,nullif Value isnullor conversion fails.
adjust
public Value adjust(TemporalAdjuster temporalAdjuster) throws DateTimeException, ArithmeticException Adjusts the current temporal value with a temporal adjuster.The current value type must be of one of the supported types:
- LocalTime,
- OffsetTime,
- LocalDate,
- MonthDay,
- Year,
- YearMonth,
- LocalDateTime,
- OffsetDateTime or
- ZonedDateTime,
IllegalStateExceptionis thrown.This method makes it possible to update e.g. a LocalDateTime with a LocalTime, returning a new LocalDateTime Value with the same LocalDate, but with the new LocalTime.
- Parameters:
temporalAdjuster- Another temporal used to adjust with.- Returns:
- The new Value.
- Throws:
ArithmeticException- If numeric overflow occurs.DateTimeException- If unable to make the adjustment.IllegalStateException- If the current value is null, i.e.returnsisNull()true, or if the Value type is not of valid temporal type.