Package org.apache.openjpa.lib.meta
Class ClassArgParser
- java.lang.Object
-
- org.apache.openjpa.lib.meta.ClassArgParser
-
public class ClassArgParser extends java.lang.ObjectParser used to resolve arguments into java classes. Interprets command-line args as either class names, .class files or resources, .java files or resources, or metadata files or resources conforming to the common format defined byCFMetaDataParser. Transforms the information in these args intoClassinstances. Note that when parsing .java files, only the main class in the file is detected. Other classes defined in the file, such as inner classes, are not added to the returned classes list.- Author:
- Abe White
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classClassArgParser.ClassNameScanner
-
Constructor Summary
Constructors Constructor Description ClassArgParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ClassLoadergetClassLoader()The class loader with which to load parsed classes.java.util.Map<java.lang.Object,java.lang.String[]>mapTypeNames(MetaDataIterator itr)Return a mapping of each metadata resource to an array of its contained class names.java.util.Map<java.lang.Object,java.lang.Class<?>[]>mapTypes(MetaDataIterator itr)Return a mapping of each metadata resource to an array of its contained classes.java.lang.String[]parseTypeNames(java.lang.String arg)Return the names of the class(es) from the given arg.java.lang.String[]parseTypeNames(MetaDataIterator itr)Return the names of the class(es) from the given metadatas.java.lang.Class<?>[]parseTypes(java.lang.String arg)Return theClassrepresentation of the class(es) named in the given arg.java.lang.Class<?>[]parseTypes(MetaDataIterator itr)Return theClassrepresentation of the class(es) named in the given metadatas.voidsetClassLoader(java.lang.ClassLoader loader)The class loader with which to load parsed classes.voidsetMetaDataStructure(java.lang.String packageElementName, java.lang.String packageAttributeName, java.lang.String[] classElementNames, java.lang.String classAttributeName)Set the the relevant metadata file structure so that metadata files containing class names can be parsed.
-
-
-
Method Detail
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
The class loader with which to load parsed classes.
-
setClassLoader
public void setClassLoader(java.lang.ClassLoader loader)
The class loader with which to load parsed classes.
-
setMetaDataStructure
public void setMetaDataStructure(java.lang.String packageElementName, java.lang.String packageAttributeName, java.lang.String[] classElementNames, java.lang.String classAttributeName)Set the the relevant metadata file structure so that metadata files containing class names can be parsed. Null attribute names indicate that the text content of the element contains the data.
-
parseTypes
public java.lang.Class<?>[] parseTypes(java.lang.String arg)
Return theClassrepresentation of the class(es) named in the given arg.- Parameters:
arg- a class name, .java file, .class file, or metadata file naming the type(s) to act on
-
parseTypes
public java.lang.Class<?>[] parseTypes(MetaDataIterator itr)
Return theClassrepresentation of the class(es) named in the given metadatas.
-
mapTypes
public java.util.Map<java.lang.Object,java.lang.Class<?>[]> mapTypes(MetaDataIterator itr)
Return a mapping of each metadata resource to an array of its contained classes.
-
parseTypeNames
public java.lang.String[] parseTypeNames(java.lang.String arg)
Return the names of the class(es) from the given arg.- Parameters:
arg- a class name, .java file, .class file, or metadata file naming the type(s) to act on- Throws:
java.lang.IllegalArgumentException- with appropriate message on error
-
parseTypeNames
public java.lang.String[] parseTypeNames(MetaDataIterator itr)
Return the names of the class(es) from the given metadatas.
-
mapTypeNames
public java.util.Map<java.lang.Object,java.lang.String[]> mapTypeNames(MetaDataIterator itr)
Return a mapping of each metadata resource to an array of its contained class names.
-
-