Enum MultiValueXmlHelper

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<MultiValueXmlHelper>

    public enum MultiValueXmlHelper
    extends java.lang.Enum<MultiValueXmlHelper>
    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
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addInternationalStringsToElement​(org.w3c.dom.Element element, java.util.List<org.faktorips.values.DefaultInternationalString> internationalStringList)
      Adds all international strings in the given list as a "multi-value" child element to the given element.
      static void addValuesToElement​(org.w3c.dom.Element element, java.util.List<java.lang.String> stringList)
      Adds all values in the given list as a "multi-value" child element to the given element.
      static java.util.List<org.faktorips.values.DefaultInternationalString> getInternationalStringsFromXML​(org.w3c.dom.Element attrValueElement)
      Reads DefaultInternationalString values from the XML structure.
      static java.util.List<java.lang.String> getValuesFromXML​(org.w3c.dom.Element attrValueElement)
      Reads String values from the an XML structure.
      static MultiValueXmlHelper valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static MultiValueXmlHelper[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • values

        public static MultiValueXmlHelper[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (MultiValueXmlHelper c : MultiValueXmlHelper.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static MultiValueXmlHelper valueOf​(java.lang.String name)
        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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getValuesFromXML

        public static java.util.List<java.lang.String> getValuesFromXML​(org.w3c.dom.Element attrValueElement)
        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:
        java.lang.NullPointerException - if the outer value-tag or the MultiValue-Tag can not be found
      • getInternationalStringsFromXML

        public static java.util.List<org.faktorips.values.DefaultInternationalString> getInternationalStringsFromXML​(org.w3c.dom.Element attrValueElement)
        Reads DefaultInternationalString values 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:
        java.lang.NullPointerException - if the outer value-tag or the MultiValue-Tag cannot be found
      • addValuesToElement

        public static void addValuesToElement​(org.w3c.dom.Element element,
                                              java.util.List<java.lang.String> stringList)
        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​(org.w3c.dom.Element element,
                                                            java.util.List<org.faktorips.values.DefaultInternationalString> internationalStringList)
        Adds all international strings in the given list as a "multi-value" child element to the given element.