Class YamlOps
java.lang.Object
com.github.darksoulq.abyssallib.common.serialization.DynamicOps<Object>
com.github.darksoulq.abyssallib.common.serialization.ops.YamlOps
A
DynamicOps implementation backed by SnakeYAML.
This implementation represents YAML data as plain Java objects (Map, List, primitives), enabling serialization and deserialization of hierarchical structures in a generic form.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionCreates a deep copy of a YAML structure.createBoolean(boolean value) Creates a boolean value.createByte(byte value) Creates a byte value.createDouble(double value) Creates a double value.createFloat(float value) Creates a float value.createInt(int value) Creates an int value.createList(List<Object> elements) Creates a YAML list.createLong(long value) Creates a long value.Creates a YAML map.createShort(short value) Creates a short value.createString(String value) Creates a string value.static StringSerializes a Java object into YAML.empty()Returns the YAML empty value representation.getBooleanValue(Object input) Extracts a boolean value if possible.getDoubleValue(Object input) Extracts a double value if possible.getFloatValue(Object input) Extracts a float value if possible.getIntValue(Object input) Extracts an integer value if possible.Returns map keys as strings if input is a map.Extracts a list if the input is a list.getLongValue(Object input) Extracts a long value if possible.Extracts a map if the input is a map.getNumberValue(Object input) Extracts a numeric value if possible.getStringValue(Object input) Extracts a string value if possible.parse(InputStream in) Parses YAML from an input stream.Parses YAML text into a normalized object graph.Returns the size of a collection or map.Methods inherited from class DynamicOps
compressMaps, convertTo, edit, edit, emptyList, emptyMap, exists, exists, mergeToList, mergeToMap, query, query, remove, remove, set, set
-
Field Details
-
INSTANCE
Singleton instance ofYamlOps.
-
-
Method Details
-
createString
Creates a string value.- Specified by:
createStringin classDynamicOps<Object>- Parameters:
value- the string- Returns:
- the same string object
-
createByte
Creates a byte value.- Specified by:
createBytein classDynamicOps<Object>- Parameters:
value- the byte- Returns:
- boxed byte
-
createShort
Creates a short value.- Specified by:
createShortin classDynamicOps<Object>- Parameters:
value- the short- Returns:
- boxed short
-
createInt
Creates an int value.- Specified by:
createIntin classDynamicOps<Object>- Parameters:
value- the int- Returns:
- boxed integer
-
createLong
Creates a long value.- Specified by:
createLongin classDynamicOps<Object>- Parameters:
value- the long- Returns:
- boxed long
-
createFloat
Creates a float value.- Specified by:
createFloatin classDynamicOps<Object>- Parameters:
value- the float- Returns:
- boxed float
-
createDouble
Creates a double value.- Specified by:
createDoublein classDynamicOps<Object>- Parameters:
value- the double- Returns:
- boxed double
-
createBoolean
Creates a boolean value.- Specified by:
createBooleanin classDynamicOps<Object>- Parameters:
value- the boolean- Returns:
- boxed boolean
-
createList
Creates a YAML list.- Specified by:
createListin classDynamicOps<Object>- Parameters:
elements- list elements- Returns:
- mutable ArrayList containing elements
-
createMap
-
getStringValue
Extracts a string value if possible.- Specified by:
getStringValuein classDynamicOps<Object>- Parameters:
input- input object- Returns:
- optional string
-
getNumberValue
Extracts a numeric value if possible.- Specified by:
getNumberValuein classDynamicOps<Object>- Parameters:
input- input object- Returns:
- optional number
-
getIntValue
Extracts an integer value if possible.- Specified by:
getIntValuein classDynamicOps<Object>- Parameters:
input- input object- Returns:
- optional int
-
getLongValue
Extracts a long value if possible.- Specified by:
getLongValuein classDynamicOps<Object>- Parameters:
input- input object- Returns:
- optional long
-
getFloatValue
Extracts a float value if possible.- Specified by:
getFloatValuein classDynamicOps<Object>- Parameters:
input- input object- Returns:
- optional float
-
getDoubleValue
Extracts a double value if possible.- Specified by:
getDoubleValuein classDynamicOps<Object>- Parameters:
input- input object- Returns:
- optional double
-
getBooleanValue
Extracts a boolean value if possible.- Specified by:
getBooleanValuein classDynamicOps<Object>- Parameters:
input- input object- Returns:
- optional boolean
-
getList
-
getMap
-
getKeys
-
size
Returns the size of a collection or map.- Specified by:
sizein classDynamicOps<Object>- Parameters:
input- input object- Returns:
- optional size
-
copy
Creates a deep copy of a YAML structure.- Specified by:
copyin classDynamicOps<Object>- Parameters:
input- input object- Returns:
- deep-copied structure
-
empty
Returns the YAML empty value representation.- Specified by:
emptyin classDynamicOps<Object>- Returns:
- null
-
parse
-
parse
Parses YAML from an input stream.- Parameters:
in- input stream- Returns:
- parsed object structure
-
dump
-