Package jsonvalues
Class JsStr
- java.lang.Object
-
- jsonvalues.JsPrimitive
-
- jsonvalues.JsStr
-
public final class JsStr extends JsPrimitive implements java.lang.Comparable<JsStr>
Represents an immutable json string.
-
-
Field Summary
Fields Modifier and Type Field Description static Prism<java.lang.String,byte[]>base64Prismstatic Prism<java.lang.String,java.time.Instant>instantPrismstatic Prism<JsValue,java.lang.String>prismprism between the sum type JsValue and JsStrstatic intTYPE_IDjava.lang.StringvalueThe string value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(JsStr o)Compares twoJsStrobjects lexicographically.booleanequals(java.lang.Object that)Indicates whether some other object is "equal to" this json string.inthashCode()Returns the hashcode of this json string.intid()booleanisBinary()booleanisInstant()booleanisStr()JsStrmap(java.util.function.UnaryOperator<java.lang.String> fn)Maps this JsStr into another one.static JsStrof(java.lang.String str)Static factory method to create a JsStr from a string.booleantest(java.util.function.Predicate<java.lang.String> predicate)Tests this JsStr on a predicate.JsPrimitivetoJsPrimitive()java.lang.StringtoString()Returns the string representation of this json string which is its value quoted.-
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, isBool, isDecimal, isDouble, isDouble, isFalse, isInstant, isInt, isInt, isIntegral, isJson, isLong, isLong, isNothing, isNotNothing, isNotNull, isNotNumber, isNull, isNumber, isObj, isObj, isSameType, 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 Prism<JsValue,java.lang.String> prism
prism between the sum type JsValue and JsStr
-
base64Prism
public static final Prism<java.lang.String,byte[]> base64Prism
-
instantPrism
public static final Prism<java.lang.String,java.time.Instant> instantPrism
-
value
public final java.lang.String value
The string value.
-
-
Method Detail
-
toJsPrimitive
public JsPrimitive toJsPrimitive()
- Specified by:
toJsPrimitivein interfaceJsValue
-
isStr
public boolean isStr()
-
compareTo
public int compareTo(JsStr o)
Compares twoJsStrobjects lexicographically.- Specified by:
compareToin interfacejava.lang.Comparable<JsStr>- See Also:
String.compareTo(String)
-
test
public boolean test(java.util.function.Predicate<java.lang.String> predicate)
Tests this JsStr on a predicate.- Parameters:
predicate- the predicate- Returns:
- true if this string satisfies the predicate
-
hashCode
public int hashCode()
Returns the hashcode of this json string.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashcode of this JsStr
-
equals
public boolean equals(java.lang.Object that)
Indicates whether some other object is "equal to" this json string.- Overrides:
equalsin classjava.lang.Object- Parameters:
that- the reference object with which to compare.- Returns:
- true if
thatis a JsStr with the same value asthisJsStr
-
toString
public java.lang.String toString()
Returns the string representation of this json string which is its value quoted.- Overrides:
toStringin classjava.lang.Object- Returns:
- the value quoted.
-
map
public JsStr map(java.util.function.UnaryOperator<java.lang.String> fn)
Maps this JsStr into another one.- Parameters:
fn- the mapping function- Returns:
- a new JsStr
-
of
public static JsStr of(java.lang.String str)
Static factory method to create a JsStr from a string.- Parameters:
str- the string- Returns:
- a new JsStr
-
isBinary
public boolean isBinary()
-
-