Class NullToken

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected NullToken()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] asAddress()
      Gets the contained raw IPv4 address value.
      BigDecimal asBigDecimal()
      Gets the contained numeric value.
      byte[] asBinary()
      Gets the contained binary value.
      byte[] asBinaryRef()
      Gets a reference to the contained binary value.
      boolean asBoolean()
      Gets the contained boolean value.
      CalendarDate asCalendarDate()
      Gets the contained date value.
      long asCents()
      Gets the contained cents value as a long
      char asChar()
      Gets the contained character value.
      Date asDate()
      Gets the contained date value as a java.sql.Date relative to the default time zone.
      Date asDate​(TimeZone tz)
      Gets the contained date value as a java.sql.Date relative to the given time zone.
      int asDayMillis()
      Gets the contained time value as the number of milliseconds elapsed since midnight.
      double asDouble()
      Gets the contained double value.
      Duration asDuration()
      Gets the contained Duration value as a java.time.Duration.
      long asEpochDays()
      Gets the contained date value as the number of days since Java epoch (January 1, 1970).
      long asEpochSecs()
      Gets the contained timestamp value as the number of seconds since Java epoch (January 1, 1970 00:00:00 GMT).
      float asFloat()
      Gets the contained float value.
      Inet4Address asInet4Address()
      Gets the contained IP address as an Inet4Address.
      Inet6Address asInet6Address()
      Gets the contained IP address as an Inet6Address.
      int asInt()
      Gets the contained integer value.
      long asLong()
      Gets the contained long value.
      Period asPeriod()
      Gets the contained Period value as a java.time.Period.
      long asSeconds()
      Get the contained duration value as the number of seconds.
      String asString()
      Gets the contained string value.
      TimeOfDay asTimeOfDay()
      Gets the contained time value.
      Timestamp asTimestamp()
      Gets the contained timestamp value as a java.sql.Timestamp relative to the default time zone.
      int compareTo​(NullToken o)  
      boolean equals​(Object obj)
      Indicates whether another object is equal to this token.
      int getDays()
      Gets the day portion of the contained period value.
      int getMonths()
      Gets the month portion of the contained period value.
      ScalarTokenType getType()
      Gets the data type of the token.
      int getYears()
      Gets the year portion of the contained period value.
      int hashCode()
      Returns a hash code for the token.
      boolean isNull()
      Indicates whether the token is null valued.
      boolean isZero()
      Indicates whether the value is the zero value for the type.
      int offsetSecs()
      Gets the time zone and daylight saving time offset of the contained timestamp value, in seconds.
      int subsecNanos()
      Gets the subsecond portion of the contained timestamp value.
    • Field Detail

      • NULL

        public static final NullToken NULL
        A null valued NullToken
    • Constructor Detail

      • NullToken

        protected NullToken()
    • Method Detail

      • equals

        public boolean equals​(Object obj)
        Description copied from interface: DataToken
        Indicates whether another object is equal to this token. Two null valued tokens are considered equal. This differs from the behavior of TokenComparator.equal(TokenValued,TokenValued) but makes it possible to store DataTokens in Maps.
        Specified by:
        equals in interface DataToken
        Overrides:
        equals in class Object
        Parameters:
        obj - the object to compare
        Returns:
        true if the other object is a token of the same type and contains the same value, false otherwise.
      • hashCode

        public int hashCode()
        Description copied from interface: DataToken
        Returns a hash code for the token. This value is guaranteed to be consistent with that returned by TokenConverter.asHashCode(TokenValued).
        Specified by:
        hashCode in interface DataToken
        Overrides:
        hashCode in class Object
        Returns:
        a hash code value for the token
      • isZero

        public boolean isZero()
        Description copied from interface: ScalarValued
        Indicates whether the value is the zero value for the type. Zero values are not stored in sparse representation formats.
        Specified by:
        isZero in interface ScalarValued
        Returns:
        true if the value is the zero value, false otherwise.
      • asDouble

        public double asDouble()
        Description copied from interface: DoubleValued
        Gets the contained double value.
        Specified by:
        asDouble in interface DoubleValued
        Returns:
        the contained value as a double. If null valued, as indicated by TokenValued.isNull(), Double.NaN is returned.
      • asLong

        public long asLong()
        Description copied from interface: LongValued
        Gets the contained long value.
        Specified by:
        asLong in interface LongValued
        Returns:
        the contained value as a long. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
      • asFloat

        public float asFloat()
        Description copied from interface: FloatValued
        Gets the contained float value.
        Specified by:
        asFloat in interface FloatValued
        Returns:
        the contained value as a float. If null valued, as indicated by TokenValued.isNull(), Float.NaN is returned.
      • asTimestamp

        public Timestamp asTimestamp()
        Description copied from interface: TimestampValued
        Gets the contained timestamp value as a java.sql.Timestamp relative to the default time zone. The time zone used by TimeZone#getDefault() is used.
        Specified by:
        asTimestamp in interface TimestampValued
        Returns:
        the contained value as a java.sql.Timestamp. If null valued, as indicated by TokenValued.isNull(), null is returned.
      • asEpochSecs

        public long asEpochSecs()
        Description copied from interface: TimestampValued
        Gets the contained timestamp value as the number of seconds since Java epoch (January 1, 1970 00:00:00 GMT). Timestamp values support nanosecond precision, although this method does not expose it. To access this level of detail, use subsecNanos() in conjunction with this method.
        Specified by:
        asEpochSecs in interface TimestampValued
        Returns:
        the contained value as days since Java epoch. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
        See Also:
        TimestampValued.subsecNanos()
      • subsecNanos

        public int subsecNanos()
        Description copied from interface: TimestampValued
        Gets the subsecond portion of the contained timestamp value. The value returned is relative to the seconds value returned by asEpochSecs(). Thus the value asEpochSecs() * 1000000000 + subsecNanos() represents the number of nanoseconds since Java epoch.
        Specified by:
        subsecNanos in interface DurationValued
        Specified by:
        subsecNanos in interface TimestampValued
        Returns:
        the subsecond portion of the contained value, in nanoseconds. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
        See Also:
        TimestampValued.asEpochSecs()
      • asDayMillis

        public int asDayMillis()
        Description copied from interface: TimeValued
        Gets the contained time value as the number of milliseconds elapsed since midnight.
        Specified by:
        asDayMillis in interface TimeValued
        Returns:
        the contained value as milliseconds since midnight. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
      • asTimeOfDay

        public TimeOfDay asTimeOfDay()
        Description copied from interface: TimeValued
        Gets the contained time value. This value represents the timezone free time portion of a timestamp.
        Specified by:
        asTimeOfDay in interface TimeValued
        Returns:
        the contained value. If null valued, as indicated by TokenValued.isNull(), null is returned.
      • asString

        public String asString()
        Description copied from interface: StringValued
        Gets the contained string value.
        Specified by:
        asString in interface StringValued
        Returns:
        the contained value as a String. If null valued, as indicated by TokenValued.isNull(), the empty string ("") is returned.
      • asInt

        public int asInt()
        Description copied from interface: IntValued
        Gets the contained integer value.
        Specified by:
        asInt in interface IntValued
        Returns:
        the contained value as an int. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
      • asDate

        public Date asDate()
        Description copied from interface: DateValued
        Gets the contained date value as a java.sql.Date relative to the default time zone. The time zone used by TimeZone.getDefault() is used.
        Specified by:
        asDate in interface DateValued
        Returns:
        the contained value as a java.sql.Date. If null valued, as indicated by TokenValued.isNull(), null is returned.
      • asDate

        public Date asDate​(TimeZone tz)
        Description copied from interface: DateValued
        Gets the contained date value as a java.sql.Date relative to the given time zone.
        Specified by:
        asDate in interface DateValued
        Parameters:
        tz - the time zone in which to interpret the date
        Returns:
        the contained value as a java.sql.Date. If null valued, as indicated by TokenValued.isNull(), null is returned.
      • asEpochDays

        public long asEpochDays()
        Description copied from interface: DateValued
        Gets the contained date value as the number of days since Java epoch (January 1, 1970).
        Specified by:
        asEpochDays in interface DateValued
        Returns:
        the contained value as days since Java epoch. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
      • asCalendarDate

        public CalendarDate asCalendarDate()
        Description copied from interface: DateValued
        Gets the contained date value. This value represents the timezone free date portion of a timestamp.
        Specified by:
        asCalendarDate in interface DateValued
        Returns:
        the contained value as a calendar date. If null valued, as indicated by TokenValued.isNull(), null is returned.
      • asChar

        public char asChar()
        Description copied from interface: CharValued
        Gets the contained character value.
        Specified by:
        asChar in interface CharValued
        Returns:
        the contained value as a char. If null valued, as indicated by TokenValued.isNull(), Character.MAX_VALUE is returned.
      • asBoolean

        public boolean asBoolean()
        Description copied from interface: BooleanValued
        Gets the contained boolean value.
        Specified by:
        asBoolean in interface BooleanValued
        Returns:
        the contained value as a boolean. If null valued, as indicated by TokenValued.isNull(), false is returned.
      • asBinary

        public byte[] asBinary()
        Description copied from interface: BinaryValued
        Gets the contained binary value.

        The array returned is a copy of the binary data contained in the object. To avoid this overhead, use BinaryValued.asBinaryRef() instead.

        Specified by:
        asBinary in interface BinaryValued
        Returns:
        the contained value as a byte[]. If null valued, as indicated by TokenValued.isNull(), null is returned.
      • asBinaryRef

        public byte[] asBinaryRef()
        Description copied from interface: BinaryValued
        Gets a reference to the contained binary value.

        While this call avoids the overhead seen with BinaryValued.asBinary(), the caller must guarantee that the returned array will not be modified. Failure to comply may result in the dataflow exhibiting unexpected behavior, as other operators may (or may not) see the modified value.

        Specified by:
        asBinaryRef in interface BinaryValued
        Returns:
        a reference to the byte[] holding the contained value. If null valued, as indicated by TokenValued.isNull(), null is returned.
      • asAddress

        public byte[] asAddress()
        Description copied from interface: Ip4AddressValued
        Gets the contained raw IPv4 address value. The array returned is a copy of the binary data contained in the object.
        Specified by:
        asAddress in interface Ip4AddressValued
        Specified by:
        asAddress in interface Ip6AddressValued
        Returns:
        the contained value as a byte[4]. If null valued, as indicated by TokenValued.isNull(), null is returned.
      • asPeriod

        public Period asPeriod()
        Description copied from interface: PeriodValued
        Gets the contained Period value as a java.time.Period.
        Specified by:
        asPeriod in interface PeriodValued
        Returns:
        the contained value as a java.time.Period. If null valued, as indicated by TokenValued.isNull(), null is returned.
      • getYears

        public int getYears()
        Description copied from interface: PeriodValued
        Gets the year portion of the contained period value.
        Specified by:
        getYears in interface PeriodValued
        Returns:
        the year portion of the contained value If null valued, as indicated by TokenValued.isNull(), 0 is returned.
      • getMonths

        public int getMonths()
        Description copied from interface: PeriodValued
        Gets the month portion of the contained period value. This does not include the year portion.
        Specified by:
        getMonths in interface PeriodValued
        Returns:
        the month portion of the contained value If null valued, as indicated by TokenValued.isNull(), 0 is returned.
      • getDays

        public int getDays()
        Description copied from interface: PeriodValued
        Gets the day portion of the contained period value. This does not include the year or month portion.
        Specified by:
        getDays in interface PeriodValued
        Returns:
        the day portion of the contained value If null valued, as indicated by TokenValued.isNull(), 0 is returned.
      • asDuration

        public Duration asDuration()
        Description copied from interface: DurationValued
        Gets the contained Duration value as a java.time.Duration.
        Specified by:
        asDuration in interface DurationValued
        Returns:
        the contained value as a java.time.Duration. If null valued, as indicated by TokenValued.isNull(), null is returned.
      • asCents

        public long asCents()
        Description copied from interface: MoneyValued
        Gets the contained cents value as a long
        Specified by:
        asCents in interface MoneyValued
        Returns:
        the contained cents value as a long. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
      • isNull

        public final boolean isNull()
        Description copied from interface: TokenValued
        Indicates whether the token is null valued. Tokens support null values analogous to SQL. Before accessing the value of the container, it is usually best to ensure it is not null valued using this method.
        Specified by:
        isNull in interface TokenValued
        Returns:
        true if the token is null valued, false otherwise