|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.hpi.fgis.dude.util.data.json.JsonBoolean
public class JsonBoolean
JsonBoolean
represents a boolean value that can be converted into Json.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface de.hpi.fgis.dude.util.data.json.JsonValue |
---|
JsonValue.JsonType |
Field Summary | |
---|---|
static JsonBoolean |
FALSE
A Json-convertible false . |
static JsonBoolean |
TRUE
A Json-convertible true . |
Method Summary | |
---|---|
int |
compareTo(JsonValue other)
Compares the current instance with the passed JsonValue . |
static JsonBoolean |
createJsonBoolean(boolean boolVal)
Returns the Json representation of the passed boolean value. |
static JsonBoolean |
createJsonBoolean(String jsonCode)
Returns a Json-convertible boolean based on the passed String. |
boolean |
equals(Object obj)
|
void |
fromJson(DuDeJsonParser<?> jsonParser)
Initializes the current instance using the passed DuDeJsonParser . |
String |
getStringValue()
Returns the actual value converted into a String. |
JsonValue.JsonType |
getType()
Returns JsonType.Boolean . |
boolean |
getValue()
Returns the actual value of this JsonBoolean . |
int |
hashCode()
|
int |
size()
Returns 1 since JsonBoolean is an atomic value. |
void |
toJson(DuDeJsonGenerator jsonGenerator)
Generates the Json code using the passed DuDeJsonGenerator . |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final JsonBoolean TRUE
true
.
public static final JsonBoolean FALSE
false
.
Method Detail |
---|
public static JsonBoolean createJsonBoolean(String jsonCode)
jsonCode
- The String that shall be converted into a Json-convertible boolean.
TRUE
if and only if jsonCode
is the String "true" (case-insensitive); otherwise
FALSE
.public static JsonBoolean createJsonBoolean(boolean boolVal)
boolVal
- The boolean value whose Json representation shall be returned.
TRUE
or FALSE
depending on the passed boolean value.public JsonValue.JsonType getType()
JsonType.Boolean
.
getType
in interface JsonValue
JsonValue.getType()
public String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public int size()
1
since JsonBoolean
is an atomic value.
size
in interface JsonValue
JsonValue.size()
public int compareTo(JsonValue other)
JsonValue
JsonValue
. Instances of different JsonValue.JsonType
s are ordered lexicographically except
for JsonValue.JsonType.Null
. The above mentioned requirements define the following order: null
== JsonValue.JsonType.Null
<
JsonValue.JsonType.Array
< JsonValue.JsonType.Boolean
< JsonValue.JsonType.Number
< JsonValue.JsonType.Record
< JsonValue.JsonType.String
.
compareTo
in interface JsonValue
compareTo
in interface Comparable<JsonValue>
Comparable.compareTo(Object)
public boolean getValue()
JsonBoolean
.
JsonBoolean
.public void toJson(DuDeJsonGenerator jsonGenerator) throws org.codehaus.jackson.JsonGenerationException, IOException
Jsonable
DuDeJsonGenerator
.
toJson
in interface Jsonable
jsonGenerator
- The DuDeJsonGenerator
that is used internally.
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while writing to the output.public void fromJson(DuDeJsonParser<?> jsonParser) throws org.codehaus.jackson.JsonParseException, IOException
Jsonable
DuDeJsonParser
.
fromJson
in interface Jsonable
jsonParser
- The parser that is used for extracting the data out of the Json.
org.codehaus.jackson.JsonParseException
- If an error occurs while parsing the Json.
IOException
- If an error occurs while reading from the stream.public String getStringValue()
JsonAtomic
#toString()
.
getStringValue
in interface JsonAtomic
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |