Class UDMFObject
- Author:
- Matthew Tropiano
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears all attributes from the structure.Gets a corresponding attribute by name.getBoolean
(String attributeName) Gets the boolean value of an arbitrary object attribute.getBoolean
(String attributeName, Boolean def) Gets the boolean value of an arbitrary object attribute.Gets the integer value of an arbitrary object attribute.Gets the integer value of an arbitrary object attribute.getInteger
(String attributeName) Gets the integer value of an arbitrary object attribute.getInteger
(String attributeName, Integer def) Gets the integer value of an arbitrary object attribute.Gets the string value of an arbitrary object attribute.Gets the string value of an arbitrary object attribute.iterator()
Removes a corresponding attribute by name.void
Sets an attribute value by name.void
setBoolean
(String attributeName, Boolean value) Gets the boolean value of an arbitrary object attribute.void
Gets the integer value of an arbitrary object attribute.void
setInteger
(String attributeName, Integer value) Gets the integer value of an arbitrary object attribute.void
Sets the string value of an arbitrary object attribute.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
UDMFObject
public UDMFObject()Creates a new UDMFObject.
-
-
Method Details
-
clear
public void clear()Clears all attributes from the structure. -
get
Gets a corresponding attribute by name.- Parameters:
attributeName
- the name of the attribute.- Returns:
- the corresponding value, or null if no value.
-
remove
Removes a corresponding attribute by name.- Parameters:
attributeName
- the name of the attribute.- Returns:
- the removed value, or null if no value.
-
set
Sets an attribute value by name.- Parameters:
attributeName
- the name of the attribute.value
- the value of the attribute, null to remove.
-
setBoolean
Gets the boolean value of an arbitrary object attribute. Non-empty strings and non-zero numbers aretrue
.- Parameters:
attributeName
- the attribute name (may be standardized, depending on implementation).value
- the attribute value.- Throws:
NumberFormatException
- if the value was originally a String and can't be converted.
-
getBoolean
Gets the boolean value of an arbitrary object attribute. Non-empty strings and non-zero numbers aretrue
.- Parameters:
attributeName
- the attribute name (may be standardized, depending on implementation).- Returns:
- the integer value of an object attribute, or
null
if the attribute is not implemented nor exists. - Throws:
NumberFormatException
- if the value was originally a String and can't be converted.
-
getBoolean
Gets the boolean value of an arbitrary object attribute. Non-empty strings and non-zero numbers aretrue
.- Parameters:
attributeName
- the attribute name (may be standardized, depending on implementation).def
- the default value if one does not exist.- Returns:
- the integer value of an object attribute, or
def
if the attribute is not implemented nor exists. - Throws:
NumberFormatException
- if the value was originally a String and can't be converted.
-
setInteger
Gets the integer value of an arbitrary object attribute. If the value is castable to Integer, it is cast to an Integer.Strings are attempted to be parsed as integers. Floating-point values are chopped. Booleans are 1 if true, 0 if false.
- Parameters:
attributeName
- the attribute name (may be standardized, depending on implementation).value
- the attribute value.
-
getInteger
Gets the integer value of an arbitrary object attribute. If the value is castable to Integer, it is cast to an Integer.Strings are attempted to be parsed as integers. Floating-point values are chopped. Booleans are 1 if true, 0 if false.
- Parameters:
attributeName
- the attribute name (may be standardized, depending on implementation).- Returns:
- the integer value of an object attribute, or
null
if the attribute is not implemented nor exists. - Throws:
NumberFormatException
- if the value was originally a String and can't be converted.
-
getInteger
Gets the integer value of an arbitrary object attribute. If the value is castable to Integer, it is cast to an Integer.Strings are attempted to be parsed as integers. Floating-point values are chopped. Booleans are 1 if true, 0 if false.
- Parameters:
attributeName
- the attribute name (may be standardized, depending on implementation).def
- the default value if one does not exist.- Returns:
- the integer value of an object attribute, or
def
if the attribute is not implemented nor exists. - Throws:
NumberFormatException
- if the value was originally a String and can't be converted.
-
setFloat
Gets the integer value of an arbitrary object attribute. If the value is castable to Float, it is cast to a Float.Strings are attempted to be parsed as floating point numbers. Integers are promoted. Booleans are 1.0 if true, 0.0 if false.
- Parameters:
attributeName
- the attribute name (may be standardized, depending on implementation).value
- the attribute value.- Throws:
NumberFormatException
- if the value was originally a String and can't be converted.
-
getFloat
Gets the integer value of an arbitrary object attribute. If the value is castable to Float, it is cast to a Float.Strings are attempted to be parsed as floating point numbers. Integers are promoted. Booleans are 1.0 if true, 0.0 if false.
- Parameters:
attributeName
- the attribute name (may be standardized, depending on implementation).- Returns:
- the floating-point value of an object attribute, or
null
if the attribute is not implemented nor exists. - Throws:
NumberFormatException
- if the value was originally a String and can't be converted.
-
getFloat
Gets the integer value of an arbitrary object attribute. If the value is castable to Float, it is cast to a Float.Strings are attempted to be parsed as floating point numbers. Integers are promoted. Booleans are 1.0 if true, 0.0 if false.
- Parameters:
attributeName
- the attribute name (may be standardized, depending on implementation).def
- the default value if one does not exist.- Returns:
- the floating-point value of an object attribute, or
def
if the attribute is not implemented nor exists. - Throws:
NumberFormatException
- if the value was originally a String and can't be converted.
-
setString
Sets the string value of an arbitrary object attribute. If the value is promotable to String (integers/floats/booleans), it is promoted to a String.- Parameters:
attributeName
- the attribute name (may be standardized, depending on implementation).value
- the attribute value.
-
getString
Gets the string value of an arbitrary object attribute. If the value is promotable to String (integers/floats/booleans), it is promoted to a String.- Parameters:
attributeName
- the attribute name (may be standardized, depending on implementation).- Returns:
- the string value of an object attribute, or
null
if the attribute is not implemented nor exists.
-
getString
Gets the string value of an arbitrary object attribute. If the value is promotable to String (integers/floats/booleans), it is promoted to a String.- Parameters:
attributeName
- the attribute name (may be standardized, depending on implementation).def
- the default value if one does not exist.- Returns:
- the string value of an object attribute, or
def
if the attribute is not implemented nor exists.
-
iterator
-