Package jsonvalues
Class JsStr
- java.lang.Object
-
- jsonvalues.JsStr
-
- All Implemented Interfaces:
Comparable<JsStr>
,JsElem
public final class JsStr extends Object implements JsElem, Comparable<JsStr>
Represents an immutable json string.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(JsStr o)
Compares twoJsStr
objects lexicographically.boolean
equals(@Nullable Object that)
Indicates whether some other object is "equal to" this json string.int
hashCode()
Returns the hashcode of this json string.boolean
isArray()
boolean
isBigDec()
boolean
isBigInt()
boolean
isBool()
boolean
isDouble()
boolean
isFalse()
boolean
isInt()
boolean
isLong()
boolean
isNothing()
boolean
isNull()
boolean
isNumber()
boolean
isObj()
boolean
isStr()
boolean
isTrue()
JsStr
map(UnaryOperator<String> fn)
Maps this JsStr into another one.static JsStr
of(String str)
Static factory method to create a JsStr from a string.boolean
test(Predicate<String> predicate)
Tests this JsStr on a predicate.String
toString()
Returns the string representation parse this json string which is its value quoted.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jsonvalues.JsElem
asJsArray, asJsBigDec, asJsBigInt, asJsBool, asJsDouble, asJsInt, asJsLong, asJsObj, asJson, asJsStr, isArray, isBigDec, isBigInt, isDecimal, isDouble, isInstant, isInstant, isInt, isIntegral, isJson, isJson, isLocalDate, isLocalDate, isLocalDateTime, isLocalDateTime, isLong, isNotJson, isNotNothing, isNotNull, isNotNumber, isObj, isSameType, isStr
-
-
-
-
Field Detail
-
x
public final String x
The string value.
-
-
Method Detail
-
compareTo
public int compareTo(JsStr o)
Compares twoJsStr
objects lexicographically.- Specified by:
compareTo
in interfaceComparable<JsStr>
- See Also:
String.compareTo(String)
-
equals
public boolean equals(@Nullable Object that)
Indicates whether some other object is "equal to" this json string.
-
test
public boolean test(Predicate<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.
-
map
public JsStr map(UnaryOperator<String> fn)
Maps this JsStr into another one.- Parameters:
fn
- the mapping function- Returns:
- a new JsStr
-
of
public static JsStr of(String str)
Static factory method to create a JsStr from a string.- Parameters:
str
- the string- Returns:
- a new JsStr
-
toString
public String toString()
Returns the string representation parse this json string which is its value quoted.
-
isObj
public boolean isObj()
-
isArray
public boolean isArray()
-
isNothing
public boolean isNothing()
-
isNull
public boolean isNull()
-
isNumber
public boolean isNumber()
-
isBool
public boolean isBool()
-
isTrue
public boolean isTrue()
-
isFalse
public boolean isFalse()
-
isInt
public boolean isInt()
-
isDouble
public boolean isDouble()
-
isBigDec
public boolean isBigDec()
-
isLong
public boolean isLong()
-
isStr
public boolean isStr()
-
-