java.lang.Object
net.luis.utils.io.data.xml.XmlElement
net.luis.utils.io.data.xml.XmlValue
- All Implemented Interfaces:
DefaultValueGetter
,ValueGetter
Represents a xml value element.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new xml value with the given name and boolean value.Constructs a new xml value with the given name and number value.Constructs a new xml value with the given name and string value.
The value will be escaped automatically.XmlValue
(@NotNull String name, @NotNull XmlAttributes attributes, boolean value) Constructs a new xml value with the given name, attributes and boolean value.XmlValue
(@NotNull String name, @NotNull XmlAttributes attributes, @Nullable Number value) Constructs a new xml value with the given name, attributes and number value.XmlValue
(@NotNull String name, @NotNull XmlAttributes attributes, @Nullable String value) Constructs a new xml value with the given name, attributes and string value.
The value will be escaped automatically. -
Method Summary
Modifier and TypeMethodDescriptionboolean
@NotNull String
Returns the value which is hold by this object as a string.protected @NotNull String
Returns the type of the xml element.
This is used internally for error messages.@NotNull String
Returns the raw unescaped value of the element.@NotNull String
Returns the unescaped value of the element.int
hashCode()
boolean
Checks if the xml element is self-closing.@NotNull String
Returns a string representation of this value.Methods inherited from class net.luis.utils.io.data.xml.XmlElement
addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, getAsXmlContainer, getAsXmlValue, getAttribute, getAttributeAs, getAttributeAsBoolean, getAttributeAsByte, getAttributeAsDouble, getAttributeAsFloat, getAttributeAsInteger, getAttributeAsLong, getAttributeAsNumber, getAttributeAsShort, getAttributeAsString, getAttributes, getName, isXmlContainer, isXmlValue, toBaseString, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.luis.utils.util.getter.DefaultValueGetter
getAs, getAsBoolean, getAsByte, getAsDouble, getAsFloat, getAsInteger, getAsLong, getAsNumber, getAsShort
Methods inherited from interface net.luis.utils.util.getter.ValueGetter
getAs, getAsBoolean, getAsByte, getAsDouble, getAsFloat, getAsInteger, getAsLong, getAsNumber, getAsShort
-
Field Details
-
value
The value of the xml element.
-
-
Constructor Details
-
XmlValue
Constructs a new xml value with the given name and boolean value.- Parameters:
name
- The name of the xml elementvalue
- The value of the xml element- Throws:
NullPointerException
- If the name is null
-
XmlValue
Constructs a new xml value with the given name and number value.- Parameters:
name
- The name of the xml elementvalue
- The value of the xml element- Throws:
NullPointerException
- If the name is null
-
XmlValue
Constructs a new xml value with the given name and string value.
The value will be escaped automatically.- Parameters:
name
- The name of the xml elementvalue
- The value of the xml element- Throws:
NullPointerException
- If the name is null
-
XmlValue
public XmlValue(@NotNull @NotNull String name, @NotNull @NotNull XmlAttributes attributes, boolean value) Constructs a new xml value with the given name, attributes and boolean value.- Parameters:
name
- The name of the xml elementattributes
- The attributes of the xml elementvalue
- The value of the xml element- Throws:
NullPointerException
- If the name or attributes are null
-
XmlValue
public XmlValue(@NotNull @NotNull String name, @NotNull @NotNull XmlAttributes attributes, @Nullable @Nullable Number value) Constructs a new xml value with the given name, attributes and number value.- Parameters:
name
- The name of the xml elementattributes
- The attributes of the xml elementvalue
- The value of the xml element
-
XmlValue
public XmlValue(@NotNull @NotNull String name, @NotNull @NotNull XmlAttributes attributes, @Nullable @Nullable String value) Constructs a new xml value with the given name, attributes and string value.
The value will be escaped automatically.- Parameters:
name
- The name of the xml elementattributes
- The attributes of the xml elementvalue
- The value of the xml element- Throws:
NullPointerException
- If the name or attributes are null
-
-
Method Details
-
getElementType
Description copied from class:XmlElement
Returns the type of the xml element.
This is used internally for error messages.- Overrides:
getElementType
in classXmlElement
- Returns:
- The type of the xml element
-
isSelfClosing
public boolean isSelfClosing()Description copied from class:XmlElement
Checks if the xml element is self-closing.- Overrides:
isSelfClosing
in classXmlElement
- Returns:
- Always false
-
getRawValue
Returns the raw unescaped value of the element.- Returns:
- The raw value
-
getUnescapedValue
Returns the unescaped value of the element.- Returns:
- The unescaped value
-
getAsString
Returns the value which is hold by this object as a string.
This method is equivalent togetUnescapedValue()
.- Specified by:
getAsString
in interfaceValueGetter
- Returns:
- The value as a string
-
equals
- Overrides:
equals
in classXmlElement
-
hashCode
public int hashCode()- Overrides:
hashCode
in classXmlElement
-
toString
Returns a string representation of this value.- Overrides:
toString
in classXmlElement
- Parameters:
config
- The xml config to use for the string representation- Returns:
- The string representation
- Throws:
NullPointerException
- If the config is null
-