Class MetaDataElementParser
java.lang.Object
org.jboss.metadata.parser.util.MetaDataElementParser
- All Implemented Interfaces:
XMLStreamConstants
- Direct Known Subclasses:
AddressingParser, AdministeredObjectMetaDataParser, ConnectionFactoryMetaDataParser, ContextServiceMetaDataParser, DataSourceMetaDataParser, DescriptionGroupMetaDataParser, DescriptionMetaDataParser, DisplayNameMetaDataParser, EJBLocalReferenceMetaDataParser, EJBReferenceMetaDataParser, EnvironmentEntryMetaDataParser, IconMetaDataParser, IdMetaDataParser, JMSConnectionFactoryMetaDataParser, JMSDestinationMetaDataParser, LanguageMetaDataParser, LifecycleCallbackMetaDataParser, MailSessionMetaDataParser, ManagedExecutorMetaDataParser, ManagedScheduledExecutorMetaDataParser, ManagedThreadFactoryMetaDataParser, MessageDestinationMetaDataParser, MessageDestinationReferenceMetaDataParser, ParamValueMetaDataParser, PersistenceContextReferenceMetaDataParser, PersistenceUnitReferenceMetaDataParser, PortComponentRefParser, PropertyMetaDataParser, ResourceEnvironmentReferenceMetaDataParser, ResourceInjectionMetaDataParser, ResourceInjectionTargetMetaDataParser, ResourceReferenceMetaDataParser, RespectBindingParser, RunAsMetaDataParser, SecurityRoleMetaDataParser, SecurityRoleRefMetaDataParser, ServiceReferenceHandlerChainMetaDataParser, ServiceReferenceHandlerChainsMetaDataParser, ServiceReferenceHandlerMetaDataParser, ServiceReferenceMetaDataParser, StubPropertyParser
- Author:
- Emanuel Muckenhuber
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface XMLStreamConstants
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static booleanattributeHasNamespace(XMLStreamReader reader, int i) protected static voidconsumeElementContent(XMLStreamReader reader) Consume the element content of an XML stream reader (e.g. in the event of a non-fatal parse error).protected static XMLStreamExceptionduplicateNamedElement(XMLStreamReader reader, String name) Get an exception reporting that an element of a given type and name has already been declared in this scope.final booleanDetermine if this object is the same as the given object.protected static StringgetElementText(XMLStreamReader reader) Read the element text, with trimming.protected static StringgetElementText(XMLStreamReader reader, boolean trim) Read and return the element text.protected static StringgetElementText(XMLStreamReader reader, boolean trim, PropertyReplacer propertyReplacer) Read the element text, with trimming and replace in properties.protected static StringgetElementText(XMLStreamReader reader, PropertyReplacer propertyReplacer) Read the element text, with trimming and replace in properties.final inthashCode()Get the identity hash code of this object.protected static XMLStreamExceptionmissingRequiredAttributes(XMLStreamReader reader, Set<?> required) Get an exception reporting a missing, required XML attribute.protected static XMLStreamExceptionmissingRequiredElement(XMLStreamReader reader, Set<?> required) Get an exception reporting a missing, required XML child element.protected static QNameparseQName(XMLStreamReader reader, String qname) protected static booleanreadBooleanAttributeElement(XMLStreamReader reader, String attributeName) Read an element which contains only a single boolean attribute.protected static StringreadDTDLocation(XMLStreamReader reader) protected static StringreadSchemaLocation(XMLStreamReader reader) protected static StringreadStringAttributeElement(XMLStreamReader reader, String attributeName) Read an element which contains only a single string attribute.protected static voidrequireNoAttributes(XMLStreamReader reader) Checks that the current element has no attributes, throwing anXMLStreamExceptionif one is found.protected static voidrequireNoContent(XMLStreamReader reader) Consumes the remainder of the current element, throwing anXMLStreamExceptionif it contains any child elements.protected static <K,V> NavigableMap <K, V> safeCopyMap(NavigableMap<K, V> toCopy) Returns a newTreeMapby passing the provided map to its constructor.static XMLStreamExceptionunexpectedAttribute(XMLStreamReader reader, int index) Get an exception reporting an unexpected XML attribute.protected static XMLStreamExceptionunexpectedElement(XMLStreamReader reader) Get an exception reporting an unexpected XML element.protected static XMLStreamExceptionunexpectedValue(XMLStreamReader reader, Throwable t) Get an exception reporting an unexpected XML element or attribute value.
-
Constructor Details
-
MetaDataElementParser
public MetaDataElementParser()
-
-
Method Details
-
unexpectedValue
Get an exception reporting an unexpected XML element or attribute value.- Parameters:
reader- the stream reader- Returns:
- the exception
-
unexpectedElement
Get an exception reporting an unexpected XML element.- Parameters:
reader- the stream reader- Returns:
- the exception
-
unexpectedAttribute
Get an exception reporting an unexpected XML attribute.- Parameters:
reader- the stream readerindex- the element index- Returns:
- the exception
-
missingRequiredAttributes
protected static XMLStreamException missingRequiredAttributes(XMLStreamReader 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
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
Checks that the current element has no attributes, throwing anXMLStreamExceptionif one is found.- Parameters:
reader- the reader- Throws:
XMLStreamException- if an error occurs
-
getElementText
Read the element text, with trimming.- Parameters:
reader- the reader- Throws:
XMLStreamException- if an error occurs
-
getElementText
protected static String getElementText(XMLStreamReader reader, PropertyReplacer propertyReplacer) throws XMLStreamException Read the element text, with trimming and replace in properties.- Parameters:
reader- the readerpropertyReplacer- propertyReplacer- Throws:
XMLStreamException- if an error occurs
-
getElementText
protected static String getElementText(XMLStreamReader reader, boolean trim, PropertyReplacer propertyReplacer) throws XMLStreamException Read the element text, with trimming and replace in properties.- Parameters:
reader- the readertrim- True if the text has to be trimmed before returning. False otherwisepropertyReplacer- propertyReplacer- Throws:
XMLStreamException- if an error occurs
-
getElementText
protected static String getElementText(XMLStreamReader reader, boolean trim) throws XMLStreamException Read and return the element text. If the passedtrimvalue is true, then the text istrimmedbefore returning.- Parameters:
reader-trim- True if the text has to be trimmed before returning. False otherwise- Returns:
- Throws:
XMLStreamException
-
requireNoContent
Consumes the remainder of the current element, throwing anXMLStreamExceptionif it contains any child elements.- Parameters:
reader- the reader- Throws:
XMLStreamException- if an error occurs
-
duplicateNamedElement
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
protected static boolean readBooleanAttributeElement(XMLStreamReader reader, String attributeName) throws XMLStreamException Read an element which contains only a single boolean attribute.- Parameters:
reader- the readerattributeName- the attribute name, usually "value"- Returns:
- the boolean value
- Throws:
XMLStreamException- if an error occurs or if the element does not contain the specified attribute, contains other attributes, or contains child elements.
-
readStringAttributeElement
protected static String readStringAttributeElement(XMLStreamReader reader, String attributeName) throws XMLStreamException 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:
XMLStreamException- if an error occurs or if the element does not contain the specified attribute, contains other attributes, or contains child elements.
-
readSchemaLocation
- Throws:
XMLStreamException
-
readDTDLocation
- Throws:
XMLStreamException
-
parseQName
-
attributeHasNamespace
-
consumeElementContent
Consume the element content of an XML stream reader (e.g. in the event of a non-fatal parse error).- Parameters:
reader- the XML stream reader- Throws:
XMLStreamException
-
equals
-
hashCode
-