Package jsonvalues
Class JsInstant
- java.lang.Object
-
- jsonvalues.JsPrimitive
-
- jsonvalues.JsInstant
-
- All Implemented Interfaces:
Comparable<JsInstant>,JsValue
public final class JsInstant extends JsPrimitive implements Comparable<JsInstant>
Represents an immutable instant. An instant is not part of the Json specification. It is serialized into it's 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(JsInstant.of(a)) // true
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(JsInstant o)booleanequals(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(Function<Instant,Instant> fn)static JsInstantof(String instant)static JsInstantof(Instant instant)JsPrimitivetoJsPrimitive()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
-
prism
public static final fun.optic.Prism<JsValue,Instant> prism
prism between the sum type JsValue and JsInstant
-
value
public final Instant value
-
-
Method Detail
-
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
-
compareTo
public int compareTo(JsInstant o)
- Specified by:
compareToin interfaceComparable<JsInstant>
-
-