Class ParseUtils
java.lang.Object
org.infinispan.configuration.parsing.ParseUtils
- Author:
- David M. Lloyd
-
Method Summary
Modifier and TypeMethodDescriptionstatic CacheConfigurationException
attributeRemoved
(ConfigurationReader reader, int attributeIndex) static CacheConfigurationException
attributeRemoved
(ConfigurationReader reader, int attributeIndex, String newAttributeName) 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.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.static CacheConfigurationException
elementRemoved
(ConfigurationReader reader) static CacheConfigurationException
elementRemoved
(ConfigurationReader reader, String newElementName) static Namespace[]
getNamespaceAnnotations
(Class<?> cls) static void
ignoreAttribute
(ConfigurationReader reader, int attributeIndex) static void
ignoreAttribute
(ConfigurationReader reader, Enum<?> attribute) static void
ignoreAttribute
(ConfigurationReader reader, String attributeName) static void
ignoreElement
(ConfigurationReader reader, Enum<?> element) static void
introducedFrom
(ConfigurationReader reader, int major, int minor) static ConfigurationReaderException
invalidAttributeValue
(ConfigurationReader reader, int index) Get an exception reporting an invalid XML attribute value.static boolean
isNoNamespaceAttribute
(ConfigurationReader reader, int index) static ConfigurationReaderException
missingRequired
(ConfigurationReader reader, Set<?> required) Get an exception reporting a missing, required XML attribute.static ConfigurationReaderException
missingRequiredElement
(ConfigurationReader reader, Set<?> required) Get an exception reporting a missing, required XML child element.static Element
nextElement
(ConfigurationReader reader) static void
parseAttributes
(ConfigurationReader reader, Builder<?> builder) static boolean
parseBoolean
(ConfigurationReader reader, int i, String value) static <T extends Enum<T>>
TparseEnum
(ConfigurationReader reader, int i, Class<T> enumClass, String value) static Integer
parseInt
(ConfigurationReader reader, int i, String value) static long
parseLong
(ConfigurationReader reader, int i, String value) static boolean
readBooleanAttributeElement
(ConfigurationReader reader, String attributeName) Read an element which contains only a single boolean attribute.static String
readStringAttributeElement
(ConfigurationReader reader, String attributeName) Read an element which contains only a single string attribute.static void
removedSince
(ConfigurationReader reader, int major, int minor) static String
requireAttributeProperty
(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 void
Checks that the current element has no attributes, throwing anConfigurationReaderException
if one is found.static void
requireNoContent
(ConfigurationReader reader) Consumes the remainder of the current element, throwing anConfigurationReaderException
if it contains any child elements.static void
requireNoNamespaceAttribute
(ConfigurationReader reader, int index) static String
requireSingleAttribute
(ConfigurationReader reader, Enum<?> attribute) static String
requireSingleAttribute
(ConfigurationReader reader, String attributeName) Require that the current element have only a single attribute with the given name.static String
resolvePath
(String path, String relativeTo) static ConfigurationReaderException
unexpectedAttribute
(ConfigurationReader reader, int index) Get an exception reporting an unexpected XML attribute.static ConfigurationReaderException
unexpectedAttribute
(ConfigurationReader reader, String name) Get an exception reporting an unexpected XML attribute.static ConfigurationReaderException
unexpectedElement
(ConfigurationReader reader) Get an exception reporting an unexpected XML element.static ConfigurationReaderException
unexpectedElement
(ConfigurationReader reader, String element) static <T extends Enum<T>>
ConfigurationReaderExceptionunexpectedElement
(ConfigurationReader reader, T element) static ConfigurationReaderException
Get 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 anConfigurationReaderException
if one is found.- Parameters:
reader
- the reader- Throws:
ConfigurationReaderException
- if an error occurs
-
requireNoContent
Consumes the remainder of the current element, throwing anConfigurationReaderException
if 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
-
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
-
introducedFrom
-
removedSince
-