Package org.faktorips.runtime.internal
Enum ValueToXmlHelper
- All Implemented Interfaces:
Serializable
,Comparable<ValueToXmlHelper>
,java.lang.constant.Constable
Helper class to write values to XML and retrieve them from XML.
- Author:
- Jan Ortmann
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
Since 3.19 the ConfigElement was separated in ConfiguredDefault and ConfiguredValueSet.static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
Used for both the value of a config element and the values of an enum value set.static final String
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addCDataValueToElement
(String value, Element el, String tagName) Adds the value to the given xml element.static void
addInternationalStringToElement
(org.faktorips.values.DefaultInternationalString value, Element el, String tagName) Adds theDefaultInternationalString
to the given xml element.static void
addTableUsageToElement
(Element el, String structureUsage, String tableContentName) Adds a table usage to the XML element.static Element
addValueAndReturnElement
(String value, Element el, String tagName) Adds the value to the given xml element as doesaddValueToElement(String, Element, String)
.static void
addValueToElement
(String value, Element el, String tagName) Adds the value to the given xml element.static Element
createValueElement
(String value, String tagName, Document ownerDocument, boolean useCDataSection) static EnumValues
getEnumValueSetFromElement
(Element el, String tagName) static org.faktorips.values.DefaultInternationalString
Returns theDefaultInternationalString
stored in the given element.static org.faktorips.values.DefaultInternationalString
getInternationalStringFromElement
(Element el, String tagName) Returns theDefaultInternationalString
stored in the child element of the given element with the indicated name.static Range
getRangeFromElement
(Element el, String tagName) static org.faktorips.valueset.StringLengthValueSet
getStringLengthValueSetFromElement
(Element el, String tagName) static <T> org.faktorips.valueset.UnrestrictedValueSet<T>
getUnrestrictedValueSet
(Element el, String tagName) static String
getValueFromElement
(Element valueEl) Returns the string representation of the value stored in given value element.static String
getValueFromElement
(Element el, String tagName) Returns the string representation of the value stored in the child element of the given element with the indicated name.static boolean
isAttributeTrue
(Element element, String attribute) Returns whether the given element has an attribute by the given name that has the value"true"
.static void
static ValueToXmlHelper
Returns the enum constant of this type with the specified name.static ValueToXmlHelper[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Field Details
-
XML_TAG_VALUE
Used for both the value of a config element and the values of an enum value set.- See Also:
-
XML_TAG_VALUE_SET
- See Also:
-
XML_TAG_DATA
- See Also:
-
LEGACY_XML_TAG_CONFIG_ELEMENT
Since 3.19 the ConfigElement was separated in ConfiguredDefault and ConfiguredValueSet. We need this for reading legacy XML.- See Also:
-
CONFIGURED_DEFAULT_PREFIX
- See Also:
-
CONFIGURED_VALUE_SET_PREFIX
- See Also:
-
XML_TAG_CONFIGURED_DEFAULT
- See Also:
-
XML_TAG_CONFIGURED_VALUE_SET
- See Also:
-
XML_TAG_ATTRIBUTE_VALUE
- See Also:
-
XML_ATTRIBUTE_ATTRIBUTE
- See Also:
-
XML_TAG_ALL_VALUES
- See Also:
-
XML_TAG_STRINGLENGTH
- See Also:
-
XML_TAG_DERIVED
- See Also:
-
XML_TAG_ENUM
- See Also:
-
XML_TAG_RANGE
- See Also:
-
XML_TAG_STEP
- See Also:
-
XML_TAG_UPPER_BOUND
- See Also:
-
XML_TAG_LOWER_BOUND
- See Also:
-
XML_TAG_TABLE_CONTENT_NAME
- See Also:
-
XML_TAG_TABLE_CONTENT_USAGE
- See Also:
-
XML_TAG_MAXIMUM_LENGTH
- See Also:
-
XML_TAG_ROW
- See Also:
-
XML_TAG_ROWS
- See Also:
-
XML_TAG_COLUMN_TABLE_REFERENCE
- See Also:
-
XML_ATTRIBUTE_STRUCTURE_USAGE
- See Also:
-
XML_ATTRIBUTE_IS_NULL
- See Also:
-
XML_ATTRIBUTE_CONTAINS_NULL
- See Also:
-
XML_ATTRIBUTE_EMPTY
- See Also:
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
addValueToElement
Adds the value to the given xml element. Takes care of proper null handling. By value we mean a value of a datatype, e.g. 42EUR is a value of the datatype money.- Parameters:
value
- the string representation of the valueel
- the xml element.tagName
- the tag name for the element that stored the value
-
addInternationalStringToElement
public static void addInternationalStringToElement(org.faktorips.values.DefaultInternationalString value, Element el, String tagName) Adds theDefaultInternationalString
to the given xml element. Takes care of proper null handling.- Parameters:
value
- theDefaultInternationalString
to be added.el
- the xml element.tagName
- the tag name for the element that stored the value.
-
addCDataValueToElement
Adds the value to the given xml element. The value is inserted inside a CDATA section.- Parameters:
value
- the string representation of the valueel
- the xml element.tagName
- the tag name for the element that stored the value
-
createValueElement
-
setValue
-
addValueAndReturnElement
Adds the value to the given xml element as doesaddValueToElement(String, Element, String)
. The created element then is returned.- Parameters:
value
- the string representation of the valueel
- the XML element to add the value to.tagName
- the tag name for the element that stored the value- Returns:
- the created element with the given tag name, that contains the given value.
-
addTableUsageToElement
public static void addTableUsageToElement(Element el, String structureUsage, String tableContentName) Adds a table usage to the XML element.- Parameters:
el
- the XML element to add the value to.structureUsage
- the value for the structureUsage XML attributetableContentName
- the name of the used table content
-
getValueFromElement
Returns the string representation of the value stored in the child element of the given element with the indicated name. Returnsnull
if the value is null or no such child element exists.<Parent> <Property isNull="false">42</Property> </Parent>
- Parameters:
el
- The xml element that is the parent of the element storing the value.tagName
- The name of the child
-
getInternationalStringFromElement
public static org.faktorips.values.DefaultInternationalString getInternationalStringFromElement(Element el, String tagName) Returns theDefaultInternationalString
stored in the child element of the given element with the indicated name. Returns an empty DefaultInternationalString if the value is null or no such child element exists.- Parameters:
el
- The xml element that is the parent of the element storing the international string.tagName
- The name of the child
-
getValueFromElement
Returns the string representation of the value stored in given value element. Returnsnull
if the value is null, the attribute isNull istrue
or no such child element exists.<Property isNull="false">42</Property>
- Parameters:
valueEl
- The xml value element containing the value.
-
getInternationalStringFromElement
public static org.faktorips.values.DefaultInternationalString getInternationalStringFromElement(Element el) Returns theDefaultInternationalString
stored in the given element. Returns an empty DefaultInternationalString if the value is null.- Parameters:
el
- The xml element storing the international string.
-
getRangeFromElement
-
getEnumValueSetFromElement
-
getStringLengthValueSetFromElement
-
getUnrestrictedValueSet
-
isAttributeTrue
Returns whether the given element has an attribute by the given name that has the value"true"
.
-