Package jsonvalues

Class JsInstant

  • All Implemented Interfaces:
    java.lang.Comparable<JsInstant>, JsValue

    public final class JsInstant
    extends JsPrimitive
    implements java.lang.Comparable<JsInstant>
    Represents an immutable instant. An instant is not part of the Json specification. It it serialized into its a string representation using ISO-8601 representation. A JsInstant and a JsStr are equals if both represent the same date. Instant a = Instant.now(); JsStr.of(a.toString()).equals(JsIntant.of(a)) // true
    • Field Detail

      • value

        public final java.time.Instant value
      • prism

        public static final Prism<JsValue,​java.time.Instant> prism
        prism between the sum type JsValue and JsInstant
    • Method Detail

      • of

        public static JsInstant of​(java.time.Instant instant)
      • map

        public JsInstant map​(java.util.function.Function<java.time.Instant,​java.time.Instant> fn)
      • id

        public int id()
        Specified by:
        id in interface JsValue
      • isInstant

        public boolean isInstant()
        Description copied from interface: JsValue
        Returns true if this JsValue is a JsInstant or a JsString which value is a date formatted in ISO-8601
        Specified by:
        isInstant in interface JsValue
        Returns:
        true if this JsValue is a JsInstant or a JsString which value is a date formatted in ISO-8601
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • compareTo

        public int compareTo​(JsInstant o)
        Specified by:
        compareTo in interface java.lang.Comparable<JsInstant>