Package jsonvalues
Class JsStr
- java.lang.Object
-
- jsonvalues.JsStr
-
- All Implemented Interfaces:
Comparable<JsStr>,JsValue
public final class JsStr extends Object implements JsValue, Comparable<JsStr>
Represents an immutable json string.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(JsStr o)Compares twoJsStrobjects lexicographically.booleanequals(Object that)Indicates whether some other object is "equal to" this json string.inthashCode()Returns the hashcode of this json string.intid()booleanisStr()JsStrmap(UnaryOperator<String> fn)Maps this JsStr into another one.static JsStrof(String str)Static factory method to create a JsStr from a string.booleantest(Predicate<String> predicate)Tests this JsStr on a predicate.StringtoString()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.JsValue
ifNothing, ifNull, 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, toJsArray, toJsBigDec, toJsBigInt, toJsBool, toJsDouble, toJsInt, toJsLong, toJsNumber, toJsObj, toJson, toJsStr
-
-
-
-
Field Detail
-
ID
public static final int ID
- See Also:
- Constant Field Values
-
value
public final String value
The string value.
-
-
Method Detail
-
isStr
public boolean isStr()
-
compareTo
public int compareTo(JsStr o)
Compares twoJsStrobjects lexicographically.- Specified by:
compareToin interfaceComparable<JsStr>- See Also:
String.compareTo(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.
-
equals
public boolean equals(Object that)
Indicates whether some other object is "equal to" this json string.
-
toString
public String toString()
Returns the string representation of this json string which is its value quoted.
-
map
public JsStr map(UnaryOperator<String> fn)
Maps this JsStr into another one.- Parameters:
fn- the mapping function- Returns:
- a new JsStr
-
-