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
isStr()
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 of 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, isArray, isBigDec, isBigDec, isBigInt, isBigInt, isBool, isDecimal, isDouble, isDouble, isFalse, isInstant, isInstant, isInt, isInt, isIntegral, isJson, isJson, isLocalDate, isLocalDate, isLocalDateTime, isLocalDateTime, isLong, isLong, isNothing, isNotJson, isNotNothing, isNotNull, isNotNumber, isNull, isNumber, isObj, isObj, isSameType, isStr, isTrue
-
-
-
-
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 of this json string which is its value quoted.
-
-