|
||||||||||
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.JsonString
public class JsonString
JsonString
represents a Json-convertible String.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface de.hpi.fgis.dude.util.data.json.JsonValue |
---|
JsonValue.JsonType |
Constructor Summary | |
---|---|
JsonString()
Initializes an empty Json-convertible String. |
|
JsonString(String value)
Initializes a new Json-convertible String. |
Method Summary | |
---|---|
int |
compareTo(JsonValue other)
Compares the current instance with the passed JsonValue . |
static JsonString |
createJsonString(String jsonCode)
Creates a JsonString instance based on the passed Json code. |
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.String . |
int |
hashCode()
|
static String |
jsonize(String str)
Converts the passed String into its Json representation. |
int |
size()
Returns 1 since JsonString is an atomic value. |
void |
toJson(DuDeJsonGenerator jsonGenerator)
Generates the Json code using the passed DuDeJsonGenerator . |
String |
toString()
Returns the actual String. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JsonString()
public JsonString(String value)
value
- The actual String value.Method Detail |
---|
public static JsonString createJsonString(String jsonCode) throws ParseException
JsonString
instance based on the passed Json code.
jsonCode
- The code that shall be converted into a JsonString
JsonString
.
ParseException
- If the passed Json code cannot be converted into a JsonString
.public JsonValue.JsonType getType()
JsonType.String
.
getType
in interface JsonValue
JsonValue.getType()
public static String jsonize(String str)
str
- The String that shall be converted.
public String getStringValue()
JsonAtomic
#toString()
.
getStringValue
in interface JsonAtomic
public String toString()
toString
in class Object
Object.toString()
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public int size()
1
since JsonString
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 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |