- All Superinterfaces:
- Hson.Value<Hson.Struct>
- Enclosing class:
- Hson
HSON Struct.
 
 A representation of a struct, with possible child values. This is similar to JsonObject in JSON-P.
- 
Nested Class SummaryNested Classes
- 
Method SummaryModifier and TypeMethodDescriptionarrayValue(String key) Get array value.booleanArray(String key) Get boolean array value.booleanValue(String key) Get a boolean value.booleanbooleanValue(String key, boolean defaultValue) Get a boolean value with default if not defined.static Hson.Struct.Builderbuilder()A new fluent API builder to construct a HSON Struct.static Hson.Structcreate()Create an empty struct.doubleValue(String key) Get double value.doubledoubleValue(String key, double defaultValue) Get a double value with default if not defined (or null).Get int value.intGet an int value with default if not defined.keys()Get all keys of this struct.numberArray(String key) Get number array value.numberValue(String key) Get number value.numberValue(String key, BigDecimal defaultValue) Get number value with default if not defined (or null).stringArray(String key) Get string array value.stringValue(String key) Get string value.stringValue(String key, String defaultValue) Get a string value with default if not defined.structArray(String key) Get struct array value.structValue(String key) Get struct value.Optional<Hson.Value<?>> Get a value.
- 
Method Details- 
builderA new fluent API builder to construct a HSON Struct.- Returns:
- a new builder
 
- 
createCreate an empty struct.- Returns:
- new empty instance
 
- 
valueGet a value.- Parameters:
- key- key under this struct
- Returns:
- value of that key, or empty if not present; may return value that represents null
- See Also:
 
- 
booleanValueGet a boolean value.- Parameters:
- key- key under this struct
- Returns:
- boolean value if present
- Throws:
- HsonException- in case the key exists, but is not a- boolean
 
- 
booleanValueGet a boolean value with default if not defined.- Parameters:
- key- key under this struct
- defaultValue- default value to use if the key does not exist
- Returns:
- boolean value, or default value if the key does not exist
- Throws:
- HsonException- in case the key exists, but is not a- Hson.Type.BOOLEAN
 
- 
structValueGet struct value. If the value representsnull, returns empty optional.- Parameters:
- key- key under this struct
- Returns:
- struct value if present
- Throws:
- HsonException- in case the key exists, but is not a- Hson.Type.STRUCT
 
- 
stringValueGet string value.- Parameters:
- key- key under this struct
- Returns:
- string value if present
- Throws:
- HsonException- in case the key exists, but is not a- Hson.Type.STRING
 
- 
stringValueGet a string value with default if not defined.- Parameters:
- key- key under this struct
- defaultValue- default value to use if the key does not exist
- Returns:
- string value, or default value if the key does not exist
- Throws:
- HsonException- in case the key exists, but is not a- Hson.Type.STRING
 
- 
intValueGet int value.- Parameters:
- key- key under this struct
- Returns:
- int value if present, from BigDecimal.intValue()
- Throws:
- HsonException- in case the key exists, but is not a- Hson.Type.NUMBER
 
- 
intValueGet an int value with default if not defined.- Parameters:
- key- key under this struct
- defaultValue- default value to use if the key does not exist
- Returns:
- int value, or default value if the key does not exist
- Throws:
- HsonException- in case the key exists, but is not a- Hson.Type.NUMBER
- See Also:
 
- 
doubleValueGet double value.- Parameters:
- key- key under this struct
- Returns:
- double value if present, from BigDecimal.doubleValue()
- Throws:
- HsonException- in case the key exists, but is not a- Hson.Type.NUMBER
 
- 
doubleValueGet a double value with default if not defined (or null).- Parameters:
- key- key under this struct
- defaultValue- default value to use if the key does not exist
- Returns:
- double value, or default value if the key does not exist
- Throws:
- HsonException- in case the key exists, but is not a- Hson.Type.NUMBER
- See Also:
 
- 
numberValueGet number value.- Parameters:
- key- key under this struct
- Returns:
- big decimal value if present
- Throws:
- HsonException- in case the key exists, but is not a- Hson.Type.NUMBER
 
- 
numberValueGet number value with default if not defined (or null).- Parameters:
- key- key under this struct
- defaultValue- default value to use if not present or null
- Returns:
- big decimal value
 
- 
stringArrayGet string array value.- Parameters:
- key- key under this struct
- Returns:
- string array value, if the key exists
- Throws:
- HsonException- in case the key exists, is an array, but elements are not strings
- HsonException- in case the key exists, but is not an array
 
- 
structArrayGet struct array value.- Parameters:
- key- key under this struct
- Returns:
- struct array value, if the key exists
- Throws:
- HsonException- in case the key exists, is an array, but elements are not structs
- HsonException- in case the key exists, but is not an array
 
- 
numberArrayGet number array value.- Parameters:
- key- key under this struct
- Returns:
- number array value, if the key exists
- Throws:
- HsonException- in case the key exists, is an array, but elements are not numbers
- HsonException- in case the key exists, but is not an array
 
- 
booleanArrayGet boolean array value.- Parameters:
- key- key under this struct
- Returns:
- boolean array value, if the key exists
- Throws:
- HsonException- in case the key exists, is an array, but elements are not booleans
- HsonException- in case the key exists, but is not an array
 
- 
arrayValueGet array value.- Parameters:
- key- key under this struct
- Returns:
- array value, if the key exists
- Throws:
- HsonException- in case the key exists, but is not an array
 
- 
keysGet all keys of this struct.- Returns:
- keys
 
 
-