Class Obj
java.lang.Object
io.github.mxz_schwarz.parser.Obj
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasNum()booleaninthashCode()booleantoBool()Returns abooleanwhenthisrepresents a boolean.toList()<E> List<E> Convenience method to cast each element in an array to a particular type.toMap()toNull()Returnsnullwhenthisrepresents null.<N extends Number>
NtoNum()Returns aNumberwhenthisrepresents a number.toStr()Returns aStringwhenthisrepresents a string.toString()
-
Constructor Details
-
Obj
public Obj()
-
-
Method Details
-
toNum
Returns aNumberwhenthisrepresents a number.- Returns:
- The value wrapped in
this. - Throws:
JSONException- Whenthisisn't aNum.
-
asNum
-
toStr
Returns aStringwhenthisrepresents a string.- Returns:
- The value wrapped in
this. - Throws:
JSONException- Whenthisisn't aStr.
-
toBool
Returns abooleanwhenthisrepresents a boolean.- Returns:
- The value wrapped in
this. - Throws:
JSONException- Whenthisisn't aBool.
-
toNull
Returnsnullwhenthisrepresents null.- Returns:
- The value wrapped in
this. - Throws:
JSONException- Whenthisisn'tNull.
-
toList
- Returns:
- The value wrapped in
this. - Throws:
JSONException- Whenthisisn't aArr.
-
toList
Convenience method to cast each element in an array to a particular type.- Type Parameters:
T- The desired generic type of theListbeing returned.- Parameters:
clazz- TheClassobject representing the desired type.- Returns:
- A list with generic type
T. - Throws:
JSONException- If thisObjis not anArror when not every element is aT.
-
castElems
- Throws:
JSONException
-
toMap
- Returns:
- The value wrapped in
this. - Throws:
JSONException- Whenthisisn't aMap.
-
toMap
- Type Parameters:
T- The desired generic type of values in the Map- Parameters:
clazz- TheClassobject representing the desired type.- Returns:
- A
Mapwith gener - Throws:
JSONException- Whenthisisn't aMapor when not every element is aT.
-
castVals
- Throws:
JSONException
-
toStdLibObj
-
toString
-
equals
-
hashCode
-