|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.jomc.tools.JomcTool
org.jomc.tools.JavaClasses
public class JavaClasses
Manages Java classes.
Use cases
commitClasses(java.io.File)commitClasses(org.jomc.model.Module, java.io.File)commitClasses(org.jomc.model.Specification, java.io.File)commitClasses(org.jomc.model.Implementation, java.io.File)validateClasses(java.io.File)validateClasses(java.lang.ClassLoader)validateClasses(org.jomc.model.Module, java.io.File)validateClasses(org.jomc.model.Module, java.lang.ClassLoader)validateClasses(org.jomc.model.Specification, org.apache.bcel.classfile.JavaClass)validateClasses(org.jomc.model.Implementation, org.apache.bcel.classfile.JavaClass)transformClasses(java.io.File, javax.xml.transform.Transformer)transformClasses(org.jomc.model.Module, java.io.File, javax.xml.transform.Transformer)transformClasses(org.jomc.model.Specification, org.apache.bcel.classfile.JavaClass, javax.xml.transform.Transformer)transformClasses(org.jomc.model.Implementation, org.apache.bcel.classfile.JavaClass, javax.xml.transform.Transformer)
JomcTool.getModules()| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.jomc.tools.JomcTool |
|---|
JomcTool.Listener |
| Constructor Summary | |
|---|---|
JavaClasses()
Creates a new JavaClasses instance. |
|
JavaClasses(JavaClasses tool)
Creates a new JavaClasses instance taking a JavaClasses instance to initialize the instance with. |
|
| Method Summary | ||
|---|---|---|
void |
commitClasses(File classesDirectory)
Commits meta-data of the modules of the instance to compiled Java classes. |
|
void |
commitClasses(Implementation implementation,
File classesDirectory)
Commits meta-data of a given implementation of the modules of the instance to compiled Java classes. |
|
void |
commitClasses(Module module,
File classesDirectory)
Commits meta-data of a given module of the modules of the instance to compiled Java classes. |
|
void |
commitClasses(Specification specification,
File classesDirectory)
Commits meta-data of a given specification of the modules of the instance to compiled Java classes. |
|
|
decodeModelObject(byte[] bytes,
Class<T> type)
Decodes a model object from a byte array. |
|
byte[] |
encodeModelObject(JAXBElement<? extends ModelObject> modelObject)
Encodes a model object to a byte array. |
|
byte[] |
getClassfileAttribute(JavaClass clazz,
String attributeName)
Gets an attribute from a java class. |
|
JavaClass |
getJavaClass(File classFile)
Parses a class file. |
|
JavaClass |
getJavaClass(InputStream stream,
String className)
Parses a class file. |
|
JavaClass |
getJavaClass(URL url,
String className)
Parses a class file. |
|
private String |
getMessage(String key,
Object args)
|
|
void |
setClassfileAttribute(JavaClass clazz,
String attributeName,
byte[] data)
Adds or updates an attribute in a java class. |
|
void |
transformClasses(File classesDirectory,
Transformer transformer)
Transforms committed meta-data of compiled Java classes of the modules of the instance. |
|
void |
transformClasses(Implementation implementation,
JavaClass javaClass,
Transformer transformer)
Transforms committed meta-data of compiled Java classes of a given implementation of the modules of the instance. |
|
void |
transformClasses(Module module,
File classesDirectory,
Transformer transformer)
Transforms committed meta-data of compiled Java classes of a given module of the modules of the instance. |
|
void |
transformClasses(Specification specification,
JavaClass javaClass,
Transformer transformer)
Transforms committed meta-data of compiled Java classes of a given specification of the modules of the instance. |
|
void |
validateClasses(ClassLoader classLoader)
Validates compiled Java classes against the modules of the instance. |
|
void |
validateClasses(File classesDirectory)
Validates compiled Java classes against the modules of the instance. |
|
void |
validateClasses(Implementation implementation,
JavaClass javaClass)
Validates compiled Java classes against a given implementation of the modules of the instance. |
|
void |
validateClasses(Module module,
ClassLoader classLoader)
Validates compiled Java classes against a given module of the modules of the instance. |
|
void |
validateClasses(Module module,
File classesDirectory)
Validates compiled Java classes against a given module of the modules of the instance. |
|
void |
validateClasses(Specification specification,
JavaClass javaClass)
Validates compiled Java classes against a given specification of the modules of the instance. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JavaClasses()
JavaClasses instance.
public JavaClasses(JavaClasses tool)
JavaClasses instance taking a JavaClasses instance to initialize the instance with.
tool - The instance to initialize the new instance with,| Method Detail |
|---|
public void commitClasses(File classesDirectory)
throws IOException
classesDirectory - The directory holding the compiled class files.
NullPointerException - if classesDirectory is null.
IOException - if committing meta-data fails.commitClasses(org.jomc.model.Module, java.io.File)
public void commitClasses(Module module,
File classesDirectory)
throws IOException
module - The module to process.classesDirectory - The directory holding the compiled class files.
NullPointerException - if module or classesDirectory is null.
IOException - if committing meta-data fails.commitClasses(org.jomc.model.Specification, java.io.File),
commitClasses(org.jomc.model.Implementation, java.io.File)
public void commitClasses(Specification specification,
File classesDirectory)
throws IOException
specification - The specification to process.classesDirectory - The directory holding the compiled class files.
NullPointerException - if specification or classesDirectory is null.
IOException - if committing meta-data fails.
public void commitClasses(Implementation implementation,
File classesDirectory)
throws IOException
implementation - The implementation to process.classesDirectory - The directory holding the compiled class files.
NullPointerException - if implementation or classesDirectory is null.
IOException - if committing meta-data fails.
public void validateClasses(File classesDirectory)
throws IOException,
ModelException
classesDirectory - The directory holding the compiled class files.
NullPointerException - if classesDirectory is null.
IOException - if reading class files fails.
ModelException - if invalid classes are found.validateClasses(org.jomc.model.Module, java.io.File)
public void validateClasses(ClassLoader classLoader)
throws IOException,
ModelException
classLoader - The class loader to search for classes.
NullPointerException - if classLoader is null.
IOException - if reading class files fails.
ModelException - if invalid classes are found.validateClasses(org.jomc.model.Module, java.lang.ClassLoader)
public void validateClasses(Module module,
File classesDirectory)
throws IOException,
ModelException
module - The module to process.classesDirectory - The directory holding the compiled class files.
NullPointerException - if module or classesDirectory is null.
IOException - if reading class files fails.
ModelException - if invalid classes are found.validateClasses(org.jomc.model.Specification, org.apache.bcel.classfile.JavaClass),
validateClasses(org.jomc.model.Implementation, org.apache.bcel.classfile.JavaClass)
public void validateClasses(Module module,
ClassLoader classLoader)
throws IOException,
ModelException
module - The module to process.classLoader - The class loader to search for classes.
NullPointerException - if module or classLoader is null.
IOException - if reading class files fails.
ModelException - if invalid classes are found.validateClasses(org.jomc.model.Specification, org.apache.bcel.classfile.JavaClass),
validateClasses(org.jomc.model.Implementation, org.apache.bcel.classfile.JavaClass)
public void validateClasses(Specification specification,
JavaClass javaClass)
throws IOException,
ModelException
specification - The specification to process.javaClass - The class to validate.
NullPointerException - if specification or javaClass is null.
IOException - if reading class files fails.
ModelException - if invalid classes are found.
public void validateClasses(Implementation implementation,
JavaClass javaClass)
throws IOException,
ModelException
implementation - The implementation to process.javaClass - The class to validate.
NullPointerException - if implementation or javaClass is null.
IOException - if reading class files fails.
ModelException - if invalid classes are found.
public void transformClasses(File classesDirectory,
Transformer transformer)
throws IOException,
TransformerException
classesDirectory - The directory holding the compiled class files.transformer - The transformer to use for transforming the classes.
NullPointerException - if classesDirectory or transformer is null.
IOException - if accessing class files fails.
TransformerException - if transforming class files fails.transformClasses(org.jomc.model.Module, java.io.File, javax.xml.transform.Transformer)
public void transformClasses(Module module,
File classesDirectory,
Transformer transformer)
throws IOException,
TransformerException
module - The module to process.classesDirectory - The directory holding the compiled class files.transformer - The transformer to use for transforming the classes.
NullPointerException - if module, classesDirectory or transformer is null.
IOException - if accessing class files fails.
TransformerException - if transforming class files fails.transformClasses(org.jomc.model.Specification, org.apache.bcel.classfile.JavaClass, javax.xml.transform.Transformer),
transformClasses(org.jomc.model.Implementation, org.apache.bcel.classfile.JavaClass, javax.xml.transform.Transformer)
public void transformClasses(Specification specification,
JavaClass javaClass,
Transformer transformer)
throws IOException,
TransformerException
specification - The specification to process.javaClass - The java class to process.transformer - The transformer to use for transforming the classes.
NullPointerException - if specification, javaClass or transformer is null.
IOException - if accessing class files fails.
TransformerException - if transforming class files fails.
public void transformClasses(Implementation implementation,
JavaClass javaClass,
Transformer transformer)
throws TransformerException,
IOException
implementation - The implementation to process.javaClass - The java class to process.transformer - The transformer to use for transforming the classes.
NullPointerException - if implementation, javaClass or transformer is null.
IOException - if accessing class files fails.
TransformerException - if transforming class files fails.
public JavaClass getJavaClass(File classFile)
throws IOException
classFile - The class file to parse.
NullPointerException - if classFile is null.
IOException - if parsing classFile fails.
public JavaClass getJavaClass(URL url,
String className)
throws IOException
url - The URL of the class file to parse.className - The name of the class at url.
NullPointerException - if url or className is null.
IOException - if parsing fails.
public JavaClass getJavaClass(InputStream stream,
String className)
throws IOException
stream - The stream to read the class file from.className - The name of the class to read from stream.
NullPointerException - if stream or className is null.
IOException - if parsing fails.
public byte[] getClassfileAttribute(JavaClass clazz,
String attributeName)
throws IOException
clazz - The java class to get an attribute from.attributeName - The name of the attribute to get.
attributeName of clazz or null if no such attribute
exists.
NullPointerException - if clazz or attributeName is null.
IOException - if getting the attribute fails.
public void setClassfileAttribute(JavaClass clazz,
String attributeName,
byte[] data)
throws IOException
clazz - The class to update.attributeName - The name of the attribute to update.data - The new data of the attribute to update the classFile with.
NullPointerException - if clazz or attributeName is null.
IOException - if updating the class file fails.
public byte[] encodeModelObject(JAXBElement<? extends ModelObject> modelObject)
throws IOException
modelObject - The model object to encode.
modelObject.
NullPointerException - if modelObject is null.
IOException - if encoding modelObject fails.
public <T extends ModelObject> T decodeModelObject(byte[] bytes,
Class<T> type)
throws IOException
T - The type of the decoded model object.bytes - The encoded model object to decode.type - The type of the encoded model object.
bytes.
NullPointerException - if bytes or type is null.
IOException - if decoding bytes fails.
private String getMessage(String key,
Object args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||