Package org.faktorips.runtime.internal
Enum Class MultiValueXmlHelper
- All Implemented Interfaces:
Serializable,Comparable<MultiValueXmlHelper>,Constable
A helper class to load and save XML elements representing multi values as they are used in
attribute values.
This class should only contains static utility method mainly called by generated runtime code.
- Author:
- dirmeier, widmaier
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddInternationalStringsToElement(Element element, List<org.faktorips.values.DefaultInternationalString> internationalStringList) Adds allinternational stringsin the given list as a "multi-value" child element to the given element.static voidaddValuesToElement(Element element, List<String> stringList) Adds all values in the given list as a "multi-value" child element to the given element.static List<org.faktorips.values.DefaultInternationalString> getInternationalStringsFromXML(Element attrValueElement) Deprecated, for removal: This API element is subject to removal in a future version.for removal since 25.7;static List<org.faktorips.values.DefaultInternationalString> getInternationalStringsFromXML(Element attrValueElement, IProductComponent productComponent, String propertyName) ReadsDefaultInternationalStringvalues from the XML structure.getValuesFromXML(Element attrValueElement) Reads String values from the an XML structure.static MultiValueXmlHelperReturns the enum constant of this class with the specified name.static MultiValueXmlHelper[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Field Details
-
XML_TAG_MULTIVALUE
- See Also:
-
XML_TAG_VALUE
- See Also:
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException- if the argument is null
-
getValuesFromXML
Reads String values from the an XML structure. Given the below XML (in this case an AttributeValue-Element), this method will return a List containing three strings: {null, "foo", "bar"}.<AttributeValue> <Value> <MultiValue> <Value isNull="true"/> <Value isNull="false"/> foo </Value> <Value isNull="false"/> bar </Value> </MultiValue> </Value> </AttributeValue>- Parameters:
attrValueElement- the element to extract multiple values from- Returns:
- a list containing all values in the given element as strings
- Throws:
NullPointerException- if the outer value-tag or the MultiValue-Tag can not be found
-
getInternationalStringsFromXML
@Deprecated(forRemoval=true, since="25.7") public static List<org.faktorips.values.DefaultInternationalString> getInternationalStringsFromXML(Element attrValueElement) Deprecated, for removal: This API element is subject to removal in a future version.for removal since 25.7;ReadsDefaultInternationalStringvalues from the XML structure.- Parameters:
attrValueElement- the element to extract multiple values from- Returns:
- a list containing all values in the given element as international strings
- Throws:
NullPointerException- if the outer value-tag or the MultiValue-Tag cannot be found- See Also:
-
getInternationalStringsFromXML
public static List<org.faktorips.values.DefaultInternationalString> getInternationalStringsFromXML(Element attrValueElement, IProductComponent productComponent, String propertyName) ReadsDefaultInternationalStringvalues from the XML structure.The given product component and the property name are used as a fallback to load internationalized Strings from i18n.properties files. The files must be in the same package as the
model-label-and-descriptions.propertiesfiles used by theProductCmptType's MessageHelper. The keys for the translations are<the product component's runtime ID>.<the indexed property name>, where the indexed property name is<the property name>.<0-based index>to supply multiple values for multi-value multi-language Strings.- Parameters:
attrValueElement- the element to extract multiple values fromproductComponent- the product component being readpropertyName- the name of the internationalized attribute- Returns:
- a list containing all values in the given element as international strings
- Throws:
NullPointerException- if the outer value-tag or the MultiValue-Tag cannot be found
-
addValuesToElement
Adds all values in the given list as a "multi-value" child element to the given element. A list containing the values {"foo", null, "bar"} will add the following elements to the given element.<Value> <MultiValue> <Value isNull="false"/> foo </Value> <Value isNull="true"/> <Value isNull="false"/> bar </Value> </MultiValue> </Value> -
addInternationalStringsToElement
public static void addInternationalStringsToElement(Element element, List<org.faktorips.values.DefaultInternationalString> internationalStringList) Adds allinternational stringsin the given list as a "multi-value" child element to the given element.
-