org.faktorips.runtime.internal
Class MultiValueXmlHelper

java.lang.Object
  extended by org.faktorips.runtime.internal.MultiValueXmlHelper

public final class MultiValueXmlHelper
extends Object

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

Field Summary
static String XML_TAG_MULTIVALUE
           
static String XML_TAG_VALUE
           
 
Method Summary
static void addInternationalStringsToElement(Element element, 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(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)
          Reads DefaultInternationalString values from the XML structure.
static List<String> getValuesFromXML(Element attrValueElement)
          Reads String values from the a XML structure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_TAG_MULTIVALUE

public static final String XML_TAG_MULTIVALUE
See Also:
Constant Field Values

XML_TAG_VALUE

public static final String XML_TAG_VALUE
See Also:
Constant Field Values
Method Detail

getValuesFromXML

public static List<String> getValuesFromXML(Element attrValueElement)
Reads String values from the a 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

public static List<org.faktorips.values.DefaultInternationalString> getInternationalStringsFromXML(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:
NullPointerException - if the outer value-tag or the MultiValue-Tag cannot be found

addValuesToElement

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



Copyright © 2015. All rights reserved.