Package com.iizix

Class Value

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class Value
    extends java.lang.Object
    implements java.lang.Cloneable
    This is the base class for all data values that are stored in VirtualSpace.

    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 Classes 
      Modifier and TypeClassDescription
      static class Value.Category
      The enumeration of Categories.
      static class Value.Type
      The enumeration of Types.
    • Field Summary

      Fields 
      Modifier and TypeFieldDescription
      Value.Typetype
      The type of this value.
      java.lang.Objectvalue
      The Object of the value in its native format.
    • Constructor Summary

      Constructors 
      ConstructorDescription
      Value​(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.
      Value​(KString value)
      Constructs a KString value.
      Value​(ImmutableXMLGregorianCalendar value)
      Constructs an ImmutableXMLGregorianCalendar value.
      Value​(java.lang.Boolean value)
      Constructs a Boolean value.
      Value​(java.lang.Byte value)
      Constructs a Byte value.
      Value​(java.lang.Double value)
      Constructs a Double value.
      Value​(java.lang.Float value)
      Constructs a Float value.
      Value​(java.lang.Integer value)
      Constructs a Integer value.
      Value​(java.lang.Long value)
      Constructs a Long value.
      Value​(java.lang.Object value)
      Constructs a Value object from the Java native representation.
      Value​(java.lang.Short value)
      Constructs a Short value.
      Value​(java.lang.String value)
      Constructs a String value.
      Value​(java.math.BigDecimal value)
      Constructs a Decimal value.
      Value​(java.time.Duration value)
      Constructs a Duration value.
      Value​(java.time.LocalDate value)
      Constructs a LocalDate value.
      Value​(java.time.LocalDateTime value)
      Constructs a LocalDateTime value.
      Value​(java.time.LocalTime value)
      Constructs a LocalTime value.
      Value​(java.time.MonthDay value)
      Constructs a MonthDay value.
      Value​(java.time.OffsetDateTime value)
      Constructs a OffsetDateTime value.
      Value​(java.time.OffsetTime value)
      Constructs an OffsetTime value.
      Value​(java.time.Period value)
      Constructs a Period value.
      Value​(java.time.Year value)
      Constructs a Year value.
      Value​(java.time.YearMonth value)
      Constructs a YearMonth value.
      Value​(java.time.ZonedDateTime value)
      Constructs a ZonedDateTime value.
      Value​(javax.xml.datatype.Duration value)
      Constructs a value from an XML Duration.
      Value​(javax.xml.datatype.XMLGregorianCalendar value)
      Creates an immutable XMLGregorianCalendar value.
      Value​(org.w3c.dom.Element element)
      Constructs the Value from an Element.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      Valueadjust​(java.time.temporal.TemporalAdjuster temporalAdjuster)
      Adjusts the current temporal value with a temporal adjuster.
      Valueclone()
      Clones the value.
      Valueconvert​(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.
      Valueconvert​(Value.Type targetType, LocaleInfo localeInfo)
      Converts this Value from its current value type to the requested target type using the specified locale information.
      booleanequals​(Value v)
      Checks if two values are equal; the type must match as well as the value.
      booleanequals​(Value v, boolean ignoreType)
      Checks if two values are equal; the value (optionally converted) must match.
      static booleanequals​(Value v1, Value v2)
      Checks if two Value's are equal, also being null.
      static booleanequals​(Value v1, Value v2, boolean ignoreType)
      Checks if two Value's are equal, also being null.
      booleanequals​(java.lang.Object o)
      Checks if two values are equal; the type must match as well as the value.
      static ValuefromCalendar​(java.util.Calendar calendar)
      Creates a ZonedDateTime value from a Calendar.
      static ValuefromDateBasedValue​(javax.xml.datatype.XMLGregorianCalendar xcal)
      Creates a Value from an XMLGregorianCalendar depending on the datatype:
      static ValuefromDurationInMillis​(java.lang.Number millis)
      Creates a duration from a numeric value in milliseconds.
      static ValuefromLocalDate​(long millis)
      Constructs a LocaleDate value.
      static ValuefromLocalDate​(java.sql.Date date)
      Constructs a LocalDate value from an SQL date.
      static ValuefromLocalDate​(java.util.Date date)
      Constructs a Date value.
      static ValuefromLocalDateTime​(long millis)
      Constructs LocalDateTime from milliseconds since Java epoch value.
      static ValuefromLocalDateTime​(java.sql.Timestamp timestamp)
      Constructs a LocalDateTime from a Timestamp value.
      static ValuefromLocalDateTime​(java.util.Date dateAndTime)
      Constructs a LocalDateTime from a Date (and time) value.
      static ValuefromLocalTime​(long millis)
      Constructs a Time value.
      static ValuefromLocalTime​(java.sql.Time time)
      Constructs a Time value.
      static ValuefromLocalTime​(java.util.Date time)
      Constructs a Time value.
      static ValuegetDefaultValue_StringFallback​(Value.Type type, boolean isNullAllowed)
      Safely gets a shared instance of a null or default Value of the specified type depending on the isNullAllowed flag.
      intgetScale()
      Get the scale of this value.
      intgetSQLType()
      Gets the default SQL type for this Value type.
      static java.lang.StringgetSQLTypeName​(int sqlType)
      Returns the String of the given SQL Types value.
      static java.lang.StringgetString​(java.lang.Object value, Value.Type type, java.lang.String pattern, LocaleInfo localeInfo)
      Gets the value as a String with the specified pattern formatter string.
      java.lang.StringgetString​(java.lang.String pattern, LocaleInfo localeInfo)
      Gets the value as a String with the specified pattern formatter string.
      static Value.TypegetType​(java.lang.String type)
      Returns the Value Type from a given type string.
      java.lang.StringgetTypeString()
      Gets the type string.
      static Value.TypegetValueType​(java.lang.Object value)
      Guesses the type value for a Value class.
      static javax.xml.datatype.DatatypeFactorygetXMLDataFactory()
      Gets the XML datatype factory.
      static Value.TypeguessType​(java.lang.String value)
      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.
      inthashCode()
      Hash code.
      voidinitialize​(org.w3c.dom.Element element)
      Initializes an XML element from this value.
      booleanisNull()
      Checks if the value is NULL.
      static booleanisTypeClassValid​(java.lang.String classFQN)
      Checks if a fully qualified name is valid as type.
      static ValueofSQLType​(java.lang.Object value, int sqlType)
      Tries to create a Value instance with a type forced to the default SQL Type mapping.
      static ValueofType​(java.lang.Object value, Value.Type targetType, LocaleInfo localeInfo)
      Tries to create a Value instance forced to the specified type.
      static ValueparseValue​(java.lang.String value, Value.Type type, java.lang.String pattern, LocaleInfo localeInfo)
      Creates a Value object from a String using a specified pattern and locale.
      java.math.BigDecimaltoBigDecimal()
      Converts this Value and returns it as a BigDecimal using the locale looked-up from current thread or if not found, for system default.
      java.math.BigIntegertoBigInteger()
      Converts this Value and returns it as a BigInteger using the locale looked-up from current thread or if not found, for system default.
      byte[]toBinary()
      Converts this Value and returns it as a Binary byte [] using the locale looked-up from current thread or if not found, for system default.
      java.lang.BooleantoBoolean()
      Converts this Value and returns it as a Boolean using the locale looked-up from current thread or if not found, for system default.
      java.lang.BytetoByte()
      Converts this Value and returns it as a Byte using the locale looked-up from current thread or if not found, for system default.
      java.util.DatetoDate()
      Converts all date/time formats into java.util.Date.
      java.lang.DoubletoDouble()
      Converts this Value and returns it as a Double using the locale looked-up from current thread or if not found, for system default.
      java.time.DurationtoDuration()
      Converts this Value and returns it as a Duration using the locale looked-up from current thread or if not found, for system default.
      java.lang.FloattoFloat()
      Converts this Value and returns it as a Float using the locale looked-up from current thread or if not found, for system default.
      java.util.GregorianCalendartoGregorianCalendar()
      Converts all date/time formats into GregorianCalendar.
      java.lang.IntegertoInteger()
      Converts this Value and returns it as an Integer using the locale looked-up from current thread or if not found, for system default.
      KStringtoKString()
      Converts this Value and returns it as a KString using the locale looked-up from current thread or if not found, for system default.
      java.time.LocalDatetoLocalDate()
      Converts this Value and returns it as a LocalDate using the locale looked-up from current thread or if not found, for system default.
      java.time.LocalDateTimetoLocalDateTime()
      Converts this Value and returns it as a LocalDateTime using the locale looked-up from current thread or if not found, for system default.
      java.time.LocalDateTimetoLocalDateTime​(LocaleInfo localeInfo)
      Converts this Value and returns it as a LocalDateTime using the locale information specified.
      java.time.LocalTimetoLocalTime()
      Converts this Value and returns it as a LocalTime using the locale looked-up from current thread or if not found, for system default.
      java.lang.LongtoLong()
      Converts this Value and returns it as a Long using the locale looked-up from current thread or if not found, for system default.
      java.time.MonthDaytoMonthDay()
      Converts this Value and returns it as a MonthDay using the locale looked-up from current thread or if not found, for system default.
      java.time.OffsetDateTimetoOffsetDateTime()
      Converts this Value and returns it as an OffsetDateTime using the locale looked-up from current thread or if not found, for system default.
      java.time.OffsetDateTimetoOffsetDateTime​(LocaleInfo localeInfo)
      Converts this Value and returns it as an OffsetDateTime using the locale information specified.
      java.time.OffsetTimetoOffsetTime()
      Converts this Value and returns it as an OffsetTime using the locale looked-up from current thread or if not found, for system default.
      java.time.OffsetTimetoOffsetTime​(LocaleInfo localeInfo)
      Converts this Value and returns it as an OffsetTime using the locale information specified.
      java.time.PeriodtoPeriod()
      Converts this Value and returns it as a Period using the locale looked-up from current thread or if not found, for system default.
      java.lang.ShorttoShort()
      Converts this Value and returns it as a Short using the locale looked-up from current thread or if not found, for system default.
      java.sql.DatetoSQLDate()
      Converts all date/time formats into java.sql.Date.
      java.sql.TimetoSQLTime()
      Converts all date/time formats into java.sql.Time.
      java.sql.TimestamptoSQLTimestamp()
      Converts all date/time formats into java.sql.Timestamp.
      java.lang.StringtoString()
      Converts this Value and returns it as a String using the locale looked-up from current thread or if not found, for system default.
      java.lang.StringtoStringWithType()
      Produces a debug/logging string of the value (including the type).
      javax.xml.datatype.DurationtoXMLDuration()
      Converts this Value and returns it as a javax.xml.datatype.Duration using the locale looked-up from current thread or if not found, for system default.
      ImmutableXMLGregorianCalendartoXMLGregorianCalendar()
      Converts this Value and returns it as an ImmutableXMLGregorianCalendar using the locale looked-up from current thread or if not found, for system default.
      ImmutableXMLGregorianCalendartoXMLGregorianCalendar​(LocaleInfo localeInfo)
      Converts this Value and returns it as an ImmutableXMLGregorianCalendar using the locale information specified.
      java.time.YeartoYear()
      Converts this Value and returns it as a Year using the locale looked-up from current thread or if not found, for system default.
      java.time.YearMonthtoYearMonth()
      Converts this Value and returns it as a YearMonth using the locale looked-up from current thread or if not found, for system default.
      java.time.ZonedDateTimetoZonedDateTime()
      Converts this Value and returns it as a ZonedDateTime using the locale looked-up from current thread or if not found, for system default.
      java.time.ZonedDateTimetoZonedDateTime​(LocaleInfo localeInfo)
      Converts this Value and returns it as a ZonedDateTime using the locale information specified.
      static Value.TypetypeFromSQLType​(int sqlType)
      Convenience method to convert SQL types to the default mapped value type.
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • type

        public final Value.Type type
        The type of this value.
      • value

        public final java.lang.Object value
        The Object of the value in its native format.
    • Constructor Detail

      • Value

        public Value​(org.w3c.dom.Element element)
              throws java.lang.Exception
        Constructs the Value from an Element.
        Parameters:
        element - The element.
        Throws:
        java.lang.Exception - If the value could not be loaded from the element.
      • Value

        public Value​(java.lang.Object value)
        Constructs a Value object from the Java native representation. If the value parameter 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:
        java.lang.IllegalArgumentException - if the native form doesn't match what is expected.
        java.lang.NullPointerException - if the value is null.
      • Value

        public Value​(java.lang.String value)
        Constructs a String value.
        Parameters:
        value - The value.
      • Value

        public Value​(KString value)
        Constructs a KString value.
        Parameters:
        value - The value.
      • Value

        public Value​(boolean value)
        Constructs a Boolean value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.lang.Boolean value)
        Constructs a Boolean value.
        Parameters:
        value - The value.
      • Value

        public Value​(byte value)
        Constructs a Byte value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.lang.Byte value)
        Constructs a Byte value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.math.BigDecimal value)
        Constructs a Decimal value.
        Parameters:
        value - The value.
      • Value

        public Value​(short value)
        Constructs a Short value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.lang.Short value)
        Constructs a Short value.
        Parameters:
        value - The value.
      • Value

        public Value​(int value)
        Constructs a Integer value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.lang.Integer value)
        Constructs a Integer value.
        Parameters:
        value - The value.
      • Value

        public Value​(long value)
        Constructs a Long value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.lang.Long value)
        Constructs a Long value.
        Parameters:
        value - The value.
      • Value

        public Value​(float value)
        Constructs a Float value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.lang.Float value)
        Constructs a Float value.
        Parameters:
        value - The value.
      • Value

        public Value​(double value)
        Constructs a Double value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.lang.Double value)
        Constructs a Double value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.time.LocalTime value)
        Constructs a LocalTime value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.time.OffsetTime value)
        Constructs an OffsetTime value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.time.LocalDate value)
        Constructs a LocalDate value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.time.MonthDay value)
        Constructs a MonthDay value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.time.Year value)
        Constructs a Year value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.time.YearMonth value)
        Constructs a YearMonth value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.time.LocalDateTime value)
        Constructs a LocalDateTime value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.time.OffsetDateTime value)
        Constructs a OffsetDateTime value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.time.ZonedDateTime value)
        Constructs a ZonedDateTime value.
        Parameters:
        value - The value.
      • Value

        public Value​(javax.xml.datatype.XMLGregorianCalendar value)
        Creates an immutable XMLGregorianCalendar value.
        Parameters:
        value - The XMLGregorianCalendar value.
      • Value

        public Value​(java.time.Duration value)
        Constructs a Duration value.
        Parameters:
        value - The value.
      • Value

        public Value​(java.time.Period value)
        Constructs a Period value.
        Parameters:
        value - The value.
      • Value

        public Value​(javax.xml.datatype.Duration 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 Detail

      • getSQLTypeName

        public static java.lang.String getSQLTypeName​(int sqlType)
        Returns the String of the given SQL Types value.
        Parameters:
        sqlType - The SQL Types value.
        Returns:
        The String representation, or "unknown[sqlType]".
      • getType

        public static Value.Type getType​(java.lang.String type)
        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

        public static boolean isTypeClassValid​(java.lang.String classFQN)
        Checks if a fully qualified name is valid as type.
        Parameters:
        classFQN - Class name such as "java.lang.String".
        Returns:
        Type validity flag.
      • getValueType

        public static Value.Type getValueType​(java.lang.Object value)
        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

        public static Value ofType​(java.lang.Object value,
                                   Value.Type targetType,
                                   LocaleInfo localeInfo)
        Tries to create a Value instance forced to the specified type. The value is converted from the supported conversion objects that are specific to the type in question using it's convert method, i.e. calling Value.Type.valueObject method IValueObject.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 Value instance of the specified type or null if conversion failed.
      • getDefaultValue_StringFallback

        public static Value getDefaultValue_StringFallback​(Value.Type type,
                                                           boolean isNullAllowed)
        Safely gets a shared instance of a null or default Value of the specified type depending on the isNullAllowed flag. No exception is thrown if the type is invalid, as the T_String type is assumed instead.
        Parameters:
        type - The value type. If the value type is null, Value.Type.String is assumed.
        isNullAllowed - If null is allowed or not.
        Returns:
        The default or null Value of the value type.
      • typeFromSQLType

        public static Value.Type typeFromSQLType​(int sqlType)
        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

        public static Value ofSQLType​(java.lang.Object value,
                                      int sqlType)
        Tries to create a Value instance with a type forced to the default SQL Type mapping.
        Parameters:
        value - The value as a java object
        sqlType - the SQL Type to enforce
        Returns:
        a Value instance of the implied type. (default mapping of the SQL type) or null if conversion failed.
      • getXMLDataFactory

        public static javax.xml.datatype.DatatypeFactory getXMLDataFactory()
        Gets the XML datatype factory.
        Returns:
        The XML datatype factory singleton.
      • guessType

        public static Value.Type guessType​(java.lang.String value)
        Guesses the value type from a String in the following order:
        1. Long,
        2. Double,
        3. BigDecimal,
        4. ZonedDateTime,
        5. OffsetDateTime,
        6. LocalDateTime,
        7. OffsetTime,
        8. LocalTime,
        9. LocalDate,
        10. Period,
        11. Duration,
        12. MonthDay,
        13. YearMonth,
        14. Boolean.
        Parameters:
        value - The value.
        Returns:
        The type matching, or Type.String in worst case for no match.
      • fromLocalTime

        public static Value fromLocalTime​(long millis)
        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

        public static Value fromLocalTime​(java.sql.Time time)
        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

        public static Value fromLocalTime​(java.util.Date time)
        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

        public static Value fromLocalDate​(long millis)
        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

        public static Value fromLocalDate​(java.sql.Date date)
        Constructs a LocalDate value from an SQL date.
        Parameters:
        date - The SQL date.
        Returns:
        a new LocalDate value.
      • fromLocalDate

        public static Value fromLocalDate​(java.util.Date date)
        Constructs a Date value.
        Parameters:
        date - The "Java" Date.
        Returns:
        a new LocalDate value.
      • fromLocalDateTime

        public static Value fromLocalDateTime​(long millis)
        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

        public static Value fromLocalDateTime​(java.sql.Timestamp timestamp)
        Constructs a LocalDateTime from a Timestamp value.
        Parameters:
        timestamp - The timestamp value.
        Returns:
        A Value with LocalDateTime as type.
      • fromLocalDateTime

        public static Value fromLocalDateTime​(java.util.Date dateAndTime)
        Constructs a LocalDateTime from a Date (and time) value.
        Parameters:
        dateAndTime - The date/time value.
        Returns:
        A Value with LocalDateTime as type.
      • fromCalendar

        public static Value fromCalendar​(java.util.Calendar calendar)
        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

        public static Value fromDateBasedValue​(javax.xml.datatype.XMLGregorianCalendar xcal)
        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:
        java.time.DateTimeException - If the value of any field is out of range
        java.lang.IllegalStateException - If the combination of set fields does not match one of the eight defined XML Schema built-in date/time datatypes.
      • fromDurationInMillis

        public static Value fromDurationInMillis​(java.lang.Number millis)
        Creates a duration from a numeric value in milliseconds.
        Parameters:
        millis - A duration value in milliseconds.
        Returns:
        The new value.
      • initialize

        public void initialize​(org.w3c.dom.Element element)
                        throws java.lang.Exception
        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:
        java.lang.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

        public java.lang.String getTypeString()
        Gets the type string.
        Returns:
        The type string.
      • toStringWithType

        public java.lang.String toStringWithType()
        Produces a debug/logging string of the value (including the type).
        Returns:
        The string formatted as "Type[value]".
      • equals

        public boolean equals​(java.lang.Object o)
        Checks if two values are equal; the type must match as well as the value. Two values that are null must match the type.
        Overrides:
        equals in class java.lang.Object
      • equals

        public boolean equals​(Value v,
                              boolean ignoreType)
        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.
        Returns:
        The equality flag.
      • equals

        public boolean equals​(Value v)
        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

        public static boolean equals​(Value v1,
                                     Value v2,
                                     boolean ignoreType)
        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.
        Returns:
        true if both values are equal.
      • equals

        public static boolean equals​(Value v1,
                                     Value v2)
        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

        public Value clone()
        Clones the value.
        Overrides:
        clone in class java.lang.Object
        Returns:
        Value for the clone instance: the same value is returned because they are invariant/immutable, i.e. this instance is returned.
      • hashCode

        public int hashCode()
        Hash code.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        Returns the hash code.
      • getString

        public java.lang.String getString​(java.lang.String pattern,
                                          LocaleInfo localeInfo)
                                   throws java.lang.IllegalArgumentException
        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 is null, a default formatter is used.
        localeInfo - The locale information or null for default locale.
        Returns:
        The formatted value as a String. If the value is null, the return value will be null.
        Throws:
        java.lang.IllegalArgumentException - If the pattern is in error.
      • getString

        public static java.lang.String getString​(java.lang.Object value,
                                                 Value.Type type,
                                                 java.lang.String pattern,
                                                 LocaleInfo localeInfo)
                                          throws java.lang.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 is null, a default formatter is used.
        localeInfo - The locale information or null for default locale.
        Returns:
        The formatted value as a String. If the value is null, the return value will be null.
        Throws:
        java.lang.IllegalArgumentException - If the pattern is in error.
      • parseValue

        public static Value parseValue​(java.lang.String value,
                                       Value.Type type,
                                       java.lang.String pattern,
                                       LocaleInfo localeInfo)
                                throws java.text.ParseException,
                                       java.lang.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 be null.
        type - The type for the value.
        pattern - The pattern for the parser. If the pattern is null, a default parser is used.
        localeInfo - The locale information or null for default locale.
        Returns:
        A value object, never null.
        Throws:
        java.text.ParseException - For parsing errors.
        java.lang.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_OBJECT if no JDBC mapping is present.
      • getScale

        public int getScale()
        Get the scale of this value. Only interesting for BigDecimal.
        Returns:
        The scale.
      • convert

        public Value convert​(Value.Type targetType)
                      throws java.text.ParseException
        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:
        java.text.ParseException - Thrown when conversion is not possible or a parsing error occurs.
      • convert

        public Value convert​(Value.Type targetType,
                             LocaleInfo localeInfo)
                      throws java.text.ParseException
        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:
        java.text.ParseException - Thrown when conversion is not possible or a parsing error occurs.
      • toString

        public java.lang.String toString()
        Converts this Value and returns it as a String using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a KString format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Overrides:
        toString in class java.lang.Object
        Returns:
        The value as a String, or null if the Value is null.
      • toKString

        public KString toKString()
        Converts this Value and returns it as a KString using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a KString format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a KString, or null if the Value is null.
      • toBoolean

        public java.lang.Boolean toBoolean()
        Converts this Value and returns it as a Boolean using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a Boolean format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a Boolean, or null if the Value is null.
      • toByte

        public java.lang.Byte toByte()
        Converts this Value and returns it as a Byte 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 null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a Byte, or null if the Value is null.
      • toShort

        public java.lang.Short toShort()
        Converts this Value and returns it as a Short using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a Short format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a Short, or null if the Value is null.
      • toInteger

        public java.lang.Integer toInteger()
        Converts this Value and returns it as an Integer using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a Integer format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a Integer, or null if the Value is null.
      • toLong

        public java.lang.Long toLong()
        Converts this Value and returns it as a Long using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a Long format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a Long, or null if the Value is null.
      • toFloat

        public java.lang.Float toFloat()
        Converts this Value and returns it as a Float using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a Float format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a Float, or null if the Value is null.
      • toDouble

        public java.lang.Double toDouble()
        Converts this Value and returns it as a Double using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a Double format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a Double, or null if the Value is null.
      • toBigInteger

        public java.math.BigInteger toBigInteger()
        Converts this Value and returns it as a BigInteger using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a BigInteger format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a BigInteger, or null if the Value is null.
      • toBigDecimal

        public java.math.BigDecimal toBigDecimal()
        Converts this Value and returns it as a BigDecimal using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a BigDecimal format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a BigDecimal, or null if the Value is null.
      • toLocalTime

        public java.time.LocalTime toLocalTime()
        Converts this Value and returns it as a LocalTime using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a LocalTime format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a LocalTime, or null if the Value is null.
      • toOffsetTime

        public java.time.OffsetTime toOffsetTime()
        Converts this Value and returns it as an OffsetTime using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a OffsetTime format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a OffsetTime, or null if the Value is null.
      • toOffsetTime

        public java.time.OffsetTime toOffsetTime​(LocaleInfo localeInfo)
        Converts this Value and returns it as an OffsetTime using the locale information specified.

        If this Value already is in a OffsetTime format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(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, or null if the Value is null.
      • toLocalDate

        public java.time.LocalDate toLocalDate()
        Converts this Value and returns it as a LocalDate using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a LocalDate format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a LocalDate, or null if the Value is null.
      • toMonthDay

        public java.time.MonthDay toMonthDay()
        Converts this Value and returns it as a MonthDay using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a MonthDay format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a MonthDay, or null if the Value is null.
      • toYear

        public java.time.Year toYear()
        Converts this Value and returns it as a Year using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a Year format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a Year, or null if the Value is null.
      • toYearMonth

        public java.time.YearMonth toYearMonth()
        Converts this Value and returns it as a YearMonth using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a YearMonth format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a YearMonth, or null if the Value is null.
      • toLocalDateTime

        public java.time.LocalDateTime toLocalDateTime()
        Converts this Value and returns it as a LocalDateTime using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a LocalDateTime format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a LocalDateTime, or null if the Value is null.
      • toLocalDateTime

        public java.time.LocalDateTime toLocalDateTime​(LocaleInfo localeInfo)
        Converts this Value and returns it as a LocalDateTime using the locale information specified.

        If this Value already is in a LocalDateTime format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(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, or null if the Value is null.
      • toOffsetDateTime

        public java.time.OffsetDateTime toOffsetDateTime()
        Converts this Value and returns it as an OffsetDateTime using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a OffsetDateTime format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a OffsetDateTime, or null if the Value is null.
      • toOffsetDateTime

        public java.time.OffsetDateTime toOffsetDateTime​(LocaleInfo localeInfo)
        Converts this Value and returns it as an OffsetDateTime using the locale information specified.

        If this Value already is in a OffsetDateTime format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(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, or null if the Value is null.
      • toZonedDateTime

        public java.time.ZonedDateTime toZonedDateTime()
        Converts this Value and returns it as a ZonedDateTime using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a ZonedDateTime format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a ZonedDateTime, or null if the Value is null.
      • toZonedDateTime

        public java.time.ZonedDateTime toZonedDateTime​(LocaleInfo localeInfo)
        Converts this Value and returns it as a ZonedDateTime using the locale information specified.

        If this Value already is in a ZonedDateTime format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(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, or null if the Value is null.
      • toXMLGregorianCalendar

        public ImmutableXMLGregorianCalendar toXMLGregorianCalendar()
        Converts this Value and returns it as an ImmutableXMLGregorianCalendar using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in an ImmutableXMLGregorianCalendar format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as an XMLGregorianCalendar, or null if the Value is null.
      • toXMLGregorianCalendar

        public ImmutableXMLGregorianCalendar toXMLGregorianCalendar​(LocaleInfo localeInfo)
        Converts this Value and returns it as an ImmutableXMLGregorianCalendar using the locale information specified.

        If this Value already is in an ImmutableXMLGregorianCalendar format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(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, or null if the Value is null.
      • toDuration

        public java.time.Duration toDuration()
        Converts this Value and returns it as a Duration using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in an Duration format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a Duration, or null if the Value is null.
      • toPeriod

        public java.time.Period toPeriod()
        Converts this Value and returns it as a Period using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a Period format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a Period, or null if the Value is null.
      • toXMLDuration

        public javax.xml.datatype.Duration toXMLDuration()
        Converts this Value and returns it as a javax.xml.datatype.Duration using the locale looked-up from current thread or if not found, for system default.

        If this Value already is in a javax.xml.datatype.Duration format, the value is returned directly.

        If the conversion cannot be done, it is silently returning null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a javax.xml.datatype.Duration, or null if the Value is null.
      • toBinary

        public byte[] toBinary()
        Converts this Value and returns it as a Binary byte [] 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 null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead.

        Returns:
        The value as a Binary byte [], or null if the Value is null.
      • toDate

        public java.util.Date toDate()
        Converts all date/time formats into java.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 null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead. Then you convert the native date/time Value type to a java.util.Date.

        Returns:
        The Value as a java.util.Date if possible, null if Value is null or conversion fails.
      • toSQLTimestamp

        public java.sql.Timestamp toSQLTimestamp()
        Converts all date/time formats into java.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 null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead. Then you convert the native date/time Value type to a java.sql.Timestamp.

        Returns:
        The Value as a java.sql.Timestamp if possible, null if Value is null or conversion fails.
      • toSQLTime

        public java.sql.Time toSQLTime()
        Converts all date/time formats into java.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 null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead. Then you convert the native date/time Value type to a java.sql.Time.

        Returns:
        The Value as a java.sql.Time if possible, null if Value is null or conversion fails.
      • toSQLDate

        public java.sql.Date toSQLDate()
        Converts all date/time formats into java.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 null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead. Then you convert the native date/time Value type to a java.sql.Date.

        Returns:
        The Value as a java.sql.Date if possible, null if Value is null or conversion fails.
      • toGregorianCalendar

        public java.util.GregorianCalendar toGregorianCalendar()
        Converts all date/time formats into GregorianCalendar. 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 null without logging or throwing an exception. Do not use this method if you wish to have control over the conversion process, use convert(Type) or or convert(Type, LocaleInfo) instead. Then you convert the native date/time Value type to a java.sql.Date.

        Returns:
        The Value as a GregorianCalendar if possible, null if Value is null or conversion fails.
      • adjust

        public Value adjust​(java.time.temporal.TemporalAdjuster temporalAdjuster)
                     throws java.time.DateTimeException,
                            java.lang.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,
        otherwise IllegalStateException is 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:
        java.lang.ArithmeticException - If numeric overflow occurs.
        java.time.DateTimeException - If unable to make the adjustment.
        java.lang.IllegalStateException - If the current value is null, i.e. isNull() returns true, or if the Value type is not of valid temporal type.