Package jsonvalues
Class JsInstant
- java.lang.Object
-
- jsonvalues.JsPrimitive
-
- jsonvalues.JsInstant
-
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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(JsInstant o)booleanequals(java.lang.Object o)inthashCode()intid()booleanisInstant()Returns true if this JsValue is a JsInstant or a JsString which value is a date formatted in ISO-8601JsInstantmap(java.util.function.Function<java.time.Instant,java.time.Instant> fn)static JsInstantof(java.time.Instant instant)JsPrimitivetoJsPrimitive()java.lang.StringtoString()-
Methods inherited from class jsonvalues.JsPrimitive
isJson, isPrimitive
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jsonvalues.JsValue
ifNothing, ifNull, isArray, isArray, isBigDec, isBigDec, isBigInt, isBigInt, isBinary, isBool, isDecimal, isDouble, isDouble, isFalse, isInstant, isInt, isInt, isIntegral, isJson, isLong, isLong, isNothing, isNotNothing, isNotNull, isNotNumber, isNull, isNumber, isObj, isObj, isSameType, isStr, isStr, isTrue, toJsArray, toJsBigDec, toJsBigInt, toJsBinary, toJsBool, toJsDouble, toJsInstant, toJsInt, toJsLong, toJsNumber, toJsObj, toJson, toJsStr
-
-
-
-
Field Detail
-
TYPE_ID
public static final int TYPE_ID
- See Also:
- Constant Field Values
-
value
public final java.time.Instant value
-
-
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)
-
toJsPrimitive
public JsPrimitive toJsPrimitive()
- Specified by:
toJsPrimitivein interfaceJsValue
-
isInstant
public boolean isInstant()
Description copied from interface:JsValueReturns 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:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-