Class X
- java.lang.Object
-
- io.github.isotes.vs.utils.X
-
public class X extends Object
Convenience functions to access elements of project filesBased on the upstream schema, most elements may occur multiple times even if semantically only one is possible, e.g., for specifying the compiler warning level. MSBuild seems to use the last occurrence while evaluating the project. Moreover, most simple elements that seem to be strings are simply specified as
xs:any. This results in most XMLBeans generated accessors to returnList<XmlObject>, e.g.,ClCompileDocument.ClCompile.getWarningLevelList().The functions
string(List)andset(List, String)provide easy access by working on the last value of a list and treat it as a string. Additionally,set(List, String)adds an element if the list is empty. The functionsstring(XmlObject)andset(XmlObject, String)are for the case if the underlying element is modelled as a singlexs:anyelement.Based on these functions,
list(List, String)andset(List, List, CharSequence)provide get/set access to string elements that actually represent string-delimited (usually ';') lists. For this, theListElementWrapperprovides an alternative mutable list implementation that is backed directly by the underlying model.
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONFIGURATION_CONDITION
-
Constructor Summary
Constructors Constructor Description X()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ElementaddElement(Node parent, String tag)static ElementaddElement(Node parent, String tag, Map<String,String> attributes)static ElementaddStringElement(XmlObject parent, String tag, String value)static ElementaddStringElement(XmlObject parent, String tag, String value, Map<String,String> attributes)static ElementaddStringElement(Node parent, String tag, String value)static ElementaddStringElement(Node parent, String tag, String value, Map<String,String> attributes)static NodeListchildElements(XmlObject parent)static NodeListchildElements(XmlObject parent, String tag)static <T> Optional<T>component(String attributeValue, Iterable<T> components, Function<T,String> attributeGetter)static <T> Optional<T>configComponent(String config, Iterable<T> components, Function<T,String> conditionGetter)static StringconfigurationCondition(String configuration)static StringelementName(XmlObject xmlObject)static <T> TgetConfigComponent(String config, Iterable<T> components, Function<T,String> conditionGetter)static <T> TgetSimpleItem(List<SimpleItemType> simpleItems, Class<T> itemClass)static StringgetString(XmlObject xmlObject)static List<String>list(List<XmlObject> xmlObjectList)static List<String>list(List<XmlObject> xmlObjectList, String delimiterRegex)static <T> Optional<T>optionalComponent(List<T> components)static voidset(List<XmlObject> xmlObjectList, String newValue)static voidset(List<XmlObject> xmlObjectList, List<String> newValue)static voidset(List<XmlObject> xmlObjectList, List<String> newValue, CharSequence delimiter)static voidset(XmlObject xmlObject, String newValue)static voidset(Node node, String value)static <T> Optional<T>simpleItem(List<SimpleItemType> simpleItems, Class<T> itemClass)static Optional<String>string(List<XmlObject> xmlObjectList)static Optional<String>string(XmlObject xmlObject)static Stringstring(Node node)
-
-
-
Field Detail
-
CONFIGURATION_CONDITION
public static final String CONFIGURATION_CONDITION
- See Also:
- Constant Field Values
-
-
Method Detail
-
set
public static void set(List<XmlObject> xmlObjectList, List<String> newValue, CharSequence delimiter)
-
simpleItem
public static <T> Optional<T> simpleItem(List<SimpleItemType> simpleItems, Class<T> itemClass)
-
getSimpleItem
public static <T> T getSimpleItem(List<SimpleItemType> simpleItems, Class<T> itemClass)
-
component
public static <T> Optional<T> component(String attributeValue, Iterable<T> components, Function<T,String> attributeGetter)
-
configComponent
public static <T> Optional<T> configComponent(String config, Iterable<T> components, Function<T,String> conditionGetter)
-
getConfigComponent
public static <T> T getConfigComponent(String config, Iterable<T> components, Function<T,String> conditionGetter)
-
addElement
public static Element addElement(Node parent, String tag, Map<String,String> attributes)
-
addStringElement
public static Element addStringElement(Node parent, String tag, String value, Map<String,String> attributes)
-
addStringElement
public static Element addStringElement(XmlObject parent, String tag, String value, Map<String,String> attributes)
-
addStringElement
public static Element addStringElement(XmlObject parent, String tag, String value)
-
-