Package org.apache.openjpa.lib.meta
Class CFMetaDataParser
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.apache.openjpa.lib.meta.XMLMetaDataParser
org.apache.openjpa.lib.meta.CFMetaDataParser
- All Implemented Interfaces:
MetaDataParser,ContentHandler,DTDHandler,EntityResolver,ErrorHandler,LexicalHandler
- Direct Known Subclasses:
XMLPersistenceMetaDataParser
Custom SAX parser used by the system to quickly parse metadata files
for classes.
- Author:
- Abe White
-
Field Summary
Fields inherited from class org.apache.openjpa.lib.meta.XMLMetaDataParser
_extendedNamespace, _openjpaNamespace -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Class<?>classForName(String name, boolean resolve) Helper method to create theClassfor the given name, taking into account the package currently being parsed for relative class names.static Class<?>classForName(String name, String pkg, boolean resolve, ClassLoader loader) Load the given class name against the given package and the set of accepted standard packages.protected StringReturn the current class being parsed; the returned name will be fully qualified.protected StringReturn the current package being parsed.protected voidEnd a class.protected voidendClassElement(String name) Override this method marking the end of an element within a declared class.protected voidendElement(String name) Override this method marking the end of some element.protected voidendExtendedClass(String elem) protected voidendPackage(String elem) End a package.protected voidendPackageElement(String name) Override this method marking the end of an element within a declared package.protected voidendSystemElement(String name) Override this method marking the end of an element outside of any package or class.protected StringThe attribute of the class element that holds the name, or null to use the element text.protected intThe depth of the class element.protected StringThe attribute of the package element that holds the name, or null to use the element text.protected intThe depth of the package element.protected booleanisClassElementName(String name) The name of the class element.protected booleanisPackageElementName(String name) The name of the package element.protected voidreset()Override this method to clear any state and ready the parser for a new document.protected booleanstartClass(String elem, Attributes attrs) Start a class.protected booleanstartClassElement(String name, Attributes attrs) Override this method marking the start of an element within a declared class.protected booleanstartElement(String name, Attributes attrs) Override this method marking the start of some element.protected booleanstartExtendedClass(String elem, Attributes attrs) protected booleanstartPackage(String elem, Attributes attrs) Start a package.protected booleanstartPackageElement(String name, Attributes attrs) Override this method marking the start of an element within a declared package.protected booleanstartSystemElement(String name, Attributes attrs) Override this method marking the start of an element outside of any package or class.Methods inherited from class org.apache.openjpa.lib.meta.XMLMetaDataParser
addComments, addResult, characters, clear, clearDeferredMetaData, comment, currentClassLoader, currentComments, currentDepth, currentLocation, currentText, endCDATA, endDTD, endElement, endEntity, error, fatalError, finish, getClassLoader, getDocType, getException, getException, getException, getLexicalHandler, getLocation, getLog, getOverrideContextClassloader, getParseComments, getParseText, getResults, getSchemaSource, getSourceFile, getSourceIsSystemId, getSourceName, getSuffix, ignoreContent, isCaching, isParsing, isValidating, parse, parse, parse, parse, parse, parse, parsed, parseNewResource, setCaching, setClassLoader, setDocumentLocator, setLexicalHandler, setLocation, setLog, setOverrideContextClassloader, setParseComments, setParseText, setParsing, setSourceIsSystemId, setSuffix, setValidating, startCDATA, startDTD, startElement, startEntityMethods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
-
Constructor Details
-
CFMetaDataParser
public CFMetaDataParser()
-
-
Method Details
-
isPackageElementName
The name of the package element. Defaults to "package". -
getPackageAttributeName
The attribute of the package element that holds the name, or null to use the element text. Defaults to "name". -
getPackageElementDepth
protected int getPackageElementDepth()The depth of the package element. Defaults to 1. -
isClassElementName
The name of the class element. Defaults to "class". -
getClassAttributeName
The attribute of the class element that holds the name, or null to use the element text. Defaults to "name". -
getClassElementDepth
protected int getClassElementDepth()The depth of the class element. Defaults to 2. -
startElement
Description copied from class:XMLMetaDataParserOverride this method marking the start of some element. If this method returns false, the content of the element and the end element event will be ignored.- Specified by:
startElementin classXMLMetaDataParser- Throws:
SAXException
-
endElement
Description copied from class:XMLMetaDataParserOverride this method marking the end of some element.- Specified by:
endElementin classXMLMetaDataParser- Throws:
SAXException
-
startPackage
Start a package. Parses out package attribute by default. Return false to skip package element and its contents.- Throws:
SAXException
-
endPackage
End a package. Parses contained text by default. -
startClass
Start a class. Parses out class name by default. Return false to skip class element and its contents.- Throws:
SAXException
-
endClass
End a class. Parses contained text by default.- Throws:
SAXException
-
startExtendedClass
- Throws:
SAXException
-
endExtendedClass
- Throws:
SAXException
-
startSystemElement
Override this method marking the start of an element outside of any package or class.- Throws:
SAXException
-
endSystemElement
Override this method marking the end of an element outside of any package or class.- Throws:
SAXException
-
startPackageElement
Override this method marking the start of an element within a declared package.- Throws:
SAXException
-
endPackageElement
Override this method marking the end of an element within a declared package.- Throws:
SAXException
-
startClassElement
Override this method marking the start of an element within a declared class.- Throws:
SAXException
-
endClassElement
Override this method marking the end of an element within a declared class.- Throws:
SAXException
-
reset
protected void reset()Override this method to clear any state and ready the parser for a new document. Subclasses should callsuper.reset()to clear superclass state.- Overrides:
resetin classXMLMetaDataParser
-
currentClassName
Return the current class being parsed; the returned name will be fully qualified. -
currentPackage
Return the current package being parsed. -
classForName
Helper method to create theClassfor the given name, taking into account the package currently being parsed for relative class names.- Throws:
SAXException
-
classForName
Load the given class name against the given package and the set of accepted standard packages. Return null if the class cannot be loaded.
-