Class TemporalUnitOffset

    • Field Detail

      • value

        protected final long value
    • Constructor Detail

      • TemporalUnitOffset

        public TemporalUnitOffset​(long value,
                                  TemporalUnit unit)
        Creates a new temporal offset for a given temporal unit.
        Parameters:
        value - the value of the offset.
        unit - temporal unit of the offset.
        Throws:
        NullPointerException - if the given unit is null.
        IllegalArgumentException - if the given value is negative.
    • Method Detail

      • checkThatValueIsPositive

        private static void checkThatValueIsPositive​(long value)
      • getBeyondOffsetDifferenceDescription

        public String getBeyondOffsetDifferenceDescription​(Temporal temporal1,
                                                           Temporal temporal2)
        Returns description of the difference between temporal values and expected offset details. Is designed for the case when difference is beyond offset.
        Specified by:
        getBeyondOffsetDifferenceDescription in interface TemporalOffset<Temporal>
        Parameters:
        temporal1 - first temporal value which is being validated against second temporal value.
        temporal2 - second temporal value.
        Returns:
        difference description.
      • getDifference

        protected long getDifference​(Temporal temporal1,
                                     Temporal temporal2)
        Returns absolute value of the difference according to time unit.
        Parameters:
        temporal1 - the first Temporal
        temporal2 - the second Temporal
        Returns:
        absolute value of the difference according to time unit.
      • getAbsoluteDuration

        protected Duration getAbsoluteDuration​(Temporal temporal1,
                                               Temporal temporal2)
        Returns absolute value of the difference as Duration.
        Parameters:
        temporal1 - the first Temporal
        temporal2 - the second Temporal
        Returns:
        absolute value of the difference as Duration.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object