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 intcompareTo(JsStr o)Compares twoJsStrobjects lexicographically.booleanequals(@Nullable Object that)Indicates whether some other object is "equal to" this json string.inthashCode()Returns the hashcode of this json string.booleanisArray()booleanisBigDec()booleanisBigInt()booleanisBool()booleanisDouble()booleanisFalse()booleanisInt()booleanisLong()booleanisNothing()booleanisNull()booleanisNumber()booleanisObj()booleanisStr()booleanisTrue()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 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 twoJsStrobjects lexicographically.- Specified by:
compareToin 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()
-
-