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:any
element.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, theListElementWrapper
provides an alternative mutable list implementation that is backed directly by the underlying model.
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONFIGURATION_CONDITION
-
Constructor Summary
Constructors Constructor Description X()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Element
addElement(Node parent, String tag)
static Element
addElement(Node parent, String tag, Map<String,String> attributes)
static Element
addStringElement(XmlObject parent, String tag, String value)
static Element
addStringElement(XmlObject parent, String tag, String value, Map<String,String> attributes)
static Element
addStringElement(Node parent, String tag, String value)
static Element
addStringElement(Node parent, String tag, String value, Map<String,String> attributes)
static NodeList
childElements(XmlObject parent)
static NodeList
childElements(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 String
configurationCondition(String configuration)
static String
elementName(XmlObject xmlObject)
static <T> T
getConfigComponent(String config, Iterable<T> components, Function<T,String> conditionGetter)
static <T> T
getSimpleItem(List<SimpleItemType> simpleItems, Class<T> itemClass)
static String
getString(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 void
set(List<XmlObject> xmlObjectList, String newValue)
static void
set(List<XmlObject> xmlObjectList, List<String> newValue)
static void
set(List<XmlObject> xmlObjectList, List<String> newValue, CharSequence delimiter)
static void
set(XmlObject xmlObject, String newValue)
static void
set(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 String
string(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)
-
-