Class ParseUtils
java.lang.Object
org.infinispan.configuration.parsing.ParseUtils
- Author:
- David M. Lloyd
-
Method Summary
Modifier and TypeMethodDescriptionstatic CacheConfigurationExceptionattributeRemoved(ConfigurationReader reader, int attributeIndex) static CacheConfigurationExceptionattributeRemoved(ConfigurationReader reader, int attributeIndex, String newAttributeName) static ConfigurationReaderExceptionduplicateAttribute(ConfigurationReader reader, String name) Get an exception reporting that an attribute of a given name has already been declared in this scope.static ConfigurationReaderExceptionduplicateNamedElement(ConfigurationReader reader, String name) Get an exception reporting that an element of a given type and name has already been declared in this scope.static CacheConfigurationExceptionelementRemoved(ConfigurationReader reader) static CacheConfigurationExceptionelementRemoved(ConfigurationReader reader, String newElementName) static String[]getListAttributeValue(String value) static Namespace[]getNamespaceAnnotations(Class<?> cls) static voidignoreAttribute(ConfigurationReader reader, int attributeIndex) static voidignoreAttribute(ConfigurationReader reader, Enum<?> attribute) static voidignoreAttribute(ConfigurationReader reader, String attributeName) static voidignoreElement(ConfigurationReader reader, Enum<?> element) static ConfigurationReaderExceptioninvalidAttributeValue(ConfigurationReader reader, int index) Get an exception reporting an invalid XML attribute value.static booleanisNoNamespaceAttribute(ConfigurationReader reader, int index) static ConfigurationReaderExceptionmissingRequired(ConfigurationReader reader, Set<?> required) Get an exception reporting a missing, required XML attribute.static ConfigurationReaderExceptionmissingRequiredElement(ConfigurationReader reader, Set<?> required) Get an exception reporting a missing, required XML child element.static ElementnextElement(ConfigurationReader reader) static voidparseAttributes(ConfigurationReader reader, Builder<?> builder) static booleanparseBoolean(ConfigurationReader reader, int i, String value) static <T extends Enum<T>>
TparseEnum(ConfigurationReader reader, int i, Class<T> enumClass, String value) static IntegerparseInt(ConfigurationReader reader, int i, String value) static longparseLong(ConfigurationReader reader, int i, String value) static booleanreadBooleanAttributeElement(ConfigurationReader reader, String attributeName) Read an element which contains only a single boolean attribute.static StringreadStringAttributeElement(ConfigurationReader reader, String attributeName) Read an element which contains only a single string attribute.static StringrequireAttributeProperty(ConfigurationReader reader, int i) static String[]requireAttributes(ConfigurationReader reader, boolean replace, String... attributeNames) Require all the named attributes, returning their values in order.static String[]requireAttributes(ConfigurationReader reader, Enum<?>... attributes) static String[]requireAttributes(ConfigurationReader reader, String... attributeNames) static voidChecks that the current element has no attributes, throwing anConfigurationReaderExceptionif one is found.static voidrequireNoContent(ConfigurationReader reader) Consumes the remainder of the current element, throwing anConfigurationReaderExceptionif it contains any child elements.static voidrequireNoNamespaceAttribute(ConfigurationReader reader, int index) static StringrequireSingleAttribute(ConfigurationReader reader, Enum<?> attribute) static StringrequireSingleAttribute(ConfigurationReader reader, String attributeName) Require that the current element have only a single attribute with the given name.static StringresolvePath(String path, String relativeTo) static ConfigurationReaderExceptionunexpectedAttribute(ConfigurationReader reader, int index) Get an exception reporting an unexpected XML attribute.static ConfigurationReaderExceptionunexpectedAttribute(ConfigurationReader reader, String name) Get an exception reporting an unexpected XML attribute.static ConfigurationReaderExceptionunexpectedElement(ConfigurationReader reader) Get an exception reporting an unexpected XML element.static ConfigurationReaderExceptionunexpectedElement(ConfigurationReader reader, String element) static <T extends Enum<T>>
ConfigurationReaderExceptionunexpectedElement(ConfigurationReader reader, T element) static ConfigurationReaderExceptionGet an exception reporting an unexpected end tag for an XML element.
-
Method Details
-
nextElement
- Throws:
ConfigurationReaderException
-
unexpectedElement
Get an exception reporting an unexpected XML element.- Parameters:
reader- the stream reader- Returns:
- the exception
-
unexpectedElement
public static <T extends Enum<T>> ConfigurationReaderException unexpectedElement(ConfigurationReader reader, T element) -
unexpectedElement
public static ConfigurationReaderException unexpectedElement(ConfigurationReader reader, String element) -
unexpectedEndElement
Get an exception reporting an unexpected end tag for an XML element.- Parameters:
reader- the stream reader- Returns:
- the exception
-
unexpectedAttribute
public static ConfigurationReaderException unexpectedAttribute(ConfigurationReader reader, int index) Get an exception reporting an unexpected XML attribute.- Parameters:
reader- the stream readerindex- the attribute index- Returns:
- the exception
-
unexpectedAttribute
public static ConfigurationReaderException unexpectedAttribute(ConfigurationReader reader, String name) Get an exception reporting an unexpected XML attribute.- Parameters:
reader- the stream readername- the attribute name- Returns:
- the exception
-
invalidAttributeValue
public static ConfigurationReaderException invalidAttributeValue(ConfigurationReader reader, int index) Get an exception reporting an invalid XML attribute value.- Parameters:
reader- the stream readerindex- the attribute index- Returns:
- the exception
-
missingRequired
public static ConfigurationReaderException missingRequired(ConfigurationReader reader, Set<?> required) Get an exception reporting a missing, required XML attribute.- Parameters:
reader- the stream readerrequired- a set of enums whose toString method returns the attribute name- Returns:
- the exception
-
missingRequiredElement
public static ConfigurationReaderException missingRequiredElement(ConfigurationReader reader, Set<?> required) Get an exception reporting a missing, required XML child element.- Parameters:
reader- the stream readerrequired- a set of enums whose toString method returns the attribute name- Returns:
- the exception
-
requireNoAttributes
public static void requireNoAttributes(ConfigurationReader reader) throws ConfigurationReaderException Checks that the current element has no attributes, throwing anConfigurationReaderExceptionif one is found.- Parameters:
reader- the reader- Throws:
ConfigurationReaderException- if an error occurs
-
requireNoContent
Consumes the remainder of the current element, throwing anConfigurationReaderExceptionif it contains any child elements.- Parameters:
reader- the reader- Throws:
ConfigurationReaderException- if an error occurs
-
duplicateAttribute
public static ConfigurationReaderException duplicateAttribute(ConfigurationReader reader, String name) Get an exception reporting that an attribute of a given name has already been declared in this scope.- Parameters:
reader- the stream readername- the name that was redeclared- Returns:
- the exception
-
duplicateNamedElement
public static ConfigurationReaderException duplicateNamedElement(ConfigurationReader reader, String name) Get an exception reporting that an element of a given type and name has already been declared in this scope.- Parameters:
reader- the stream readername- the name that was redeclared- Returns:
- the exception
-
readBooleanAttributeElement
public static boolean readBooleanAttributeElement(ConfigurationReader reader, String attributeName) throws ConfigurationReaderException Read an element which contains only a single boolean attribute.- Parameters:
reader- the readerattributeName- the attribute name, usually "value"- Returns:
- the boolean value
- Throws:
ConfigurationReaderException- if an error occurs or if the element does not contain the specified attribute, contains other attributes, or contains child elements.
-
readStringAttributeElement
public static String readStringAttributeElement(ConfigurationReader reader, String attributeName) throws ConfigurationReaderException Read an element which contains only a single string attribute.- Parameters:
reader- the readerattributeName- the attribute name, usually "value" or "name"- Returns:
- the string value
- Throws:
ConfigurationReaderException- if an error occurs or if the element does not contain the specified attribute, contains other attributes, or contains child elements.
-
requireSingleAttribute
public static String requireSingleAttribute(ConfigurationReader reader, String attributeName) throws ConfigurationReaderException Require that the current element have only a single attribute with the given name.- Parameters:
reader- the readerattributeName- the attribute name- Throws:
ConfigurationReaderException- if an error occurs
-
requireSingleAttribute
public static String requireSingleAttribute(ConfigurationReader reader, Enum<?> attribute) throws ConfigurationReaderException - Throws:
ConfigurationReaderException
-
requireAttributes
public static String[] requireAttributes(ConfigurationReader reader, boolean replace, String... attributeNames) throws ConfigurationReaderException Require all the named attributes, returning their values in order.- Parameters:
reader- the readerattributeNames- the attribute names- Returns:
- the attribute values in order
- Throws:
ConfigurationReaderException- if an error occurs
-
requireAttributes
public static String[] requireAttributes(ConfigurationReader reader, String... attributeNames) throws ConfigurationReaderException - Throws:
ConfigurationReaderException
-
requireAttributes
public static String[] requireAttributes(ConfigurationReader reader, Enum<?>... attributes) throws ConfigurationReaderException - Throws:
ConfigurationReaderException
-
isNoNamespaceAttribute
-
requireNoNamespaceAttribute
public static void requireNoNamespaceAttribute(ConfigurationReader reader, int index) throws ConfigurationReaderException - Throws:
ConfigurationReaderException
-
getNamespaceAnnotations
-
getListAttributeValue
-
resolvePath
-
requireAttributeProperty
public static String requireAttributeProperty(ConfigurationReader reader, int i) throws ConfigurationReaderException - Throws:
ConfigurationReaderException
-
ignoreAttribute
-
ignoreAttribute
-
ignoreAttribute
-
ignoreElement
-
elementRemoved
public static CacheConfigurationException elementRemoved(ConfigurationReader reader, String newElementName) -
elementRemoved
-
attributeRemoved
public static CacheConfigurationException attributeRemoved(ConfigurationReader reader, int attributeIndex, String newAttributeName) -
attributeRemoved
public static CacheConfigurationException attributeRemoved(ConfigurationReader reader, int attributeIndex) -
parseAttributes
-
parseInt
-
parseLong
-
parseEnum
public static <T extends Enum<T>> T parseEnum(ConfigurationReader reader, int i, Class<T> enumClass, String value) -
parseBoolean
-