|
||||||||||
| 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(javax.xml.bind.Marshaller, java.io.File)commitClasses(org.jomc.model.Module, javax.xml.bind.Marshaller, java.io.File)commitClasses(org.jomc.model.Specification, javax.xml.bind.Marshaller, java.io.File)commitClasses(org.jomc.model.Implementation, javax.xml.bind.Marshaller, java.io.File)validateClasses(javax.xml.bind.Unmarshaller, java.io.File)validateClasses(javax.xml.bind.Unmarshaller, java.lang.ClassLoader)validateClasses(org.jomc.model.Module, javax.xml.bind.Unmarshaller, java.io.File)validateClasses(org.jomc.model.Module, javax.xml.bind.Unmarshaller, java.lang.ClassLoader)validateClasses(org.jomc.model.Specification, javax.xml.bind.Unmarshaller, org.apache.bcel.classfile.JavaClass)validateClasses(org.jomc.model.Implementation, javax.xml.bind.Unmarshaller, org.apache.bcel.classfile.JavaClass)transformClasses(javax.xml.bind.Marshaller, javax.xml.bind.Unmarshaller, java.io.File, java.util.List)transformClasses(org.jomc.model.Module, javax.xml.bind.Marshaller, javax.xml.bind.Unmarshaller, java.io.File, java.util.List)transformClasses(org.jomc.model.Specification, javax.xml.bind.Marshaller, javax.xml.bind.Unmarshaller, org.apache.bcel.classfile.JavaClass, java.util.List)transformClasses(org.jomc.model.Implementation, javax.xml.bind.Marshaller, javax.xml.bind.Unmarshaller, org.apache.bcel.classfile.JavaClass, java.util.List)
JomcTool.getModules(),
ModelManager.getContext(java.lang.ClassLoader),
ModelManager.getMarshaller(java.lang.ClassLoader),
ModelManager.getUnmarshaller(java.lang.ClassLoader),
ModelObjectValidationReport.isModelObjectValid()| 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(org.jomc.model.Implementation implementation,
javax.xml.bind.Marshaller marshaller,
File classesDirectory)
Commits meta-data of a given implementation of the modules of the instance to compiled Java classes. |
|
void |
commitClasses(javax.xml.bind.Marshaller marshaller,
File classesDirectory)
Commits meta-data of the modules of the instance to compiled Java classes. |
|
void |
commitClasses(org.jomc.model.Module module,
javax.xml.bind.Marshaller marshaller,
File classesDirectory)
Commits meta-data of a given module of the modules of the instance to compiled Java classes. |
|
void |
commitClasses(org.jomc.model.Specification specification,
javax.xml.bind.Marshaller marshaller,
File classesDirectory)
Commits meta-data of a given specification of the modules of the instance to compiled Java classes. |
|
|
decodeModelObject(javax.xml.bind.Unmarshaller unmarshaller,
byte[] bytes,
Class<T> type)
Decodes a model object from a byte array. |
|
byte[] |
encodeModelObject(javax.xml.bind.Marshaller marshaller,
javax.xml.bind.JAXBElement<? extends org.jomc.model.ModelObject> modelObject)
Encodes a model object to a byte array. |
|
byte[] |
getClassfileAttribute(org.apache.bcel.classfile.JavaClass clazz,
String attributeName)
Gets an attribute from a java class. |
|
org.apache.bcel.classfile.JavaClass |
getJavaClass(File classFile)
Parses a class file. |
|
org.apache.bcel.classfile.JavaClass |
getJavaClass(InputStream stream,
String className)
Parses a class file. |
|
org.apache.bcel.classfile.JavaClass |
getJavaClass(URL url,
String className)
Parses a class file. |
|
void |
setClassfileAttribute(org.apache.bcel.classfile.JavaClass clazz,
String attributeName,
byte[] data)
Adds or updates an attribute in a java class. |
|
void |
transformClasses(org.jomc.model.Implementation implementation,
javax.xml.bind.Marshaller marshaller,
javax.xml.bind.Unmarshaller unmarshaller,
org.apache.bcel.classfile.JavaClass javaClass,
List<Transformer> transformers)
Transforms committed meta-data of compiled Java classes of a given implementation of the modules of the instance. |
|
void |
transformClasses(javax.xml.bind.Marshaller marshaller,
javax.xml.bind.Unmarshaller unmarshaller,
File classesDirectory,
List<Transformer> transformers)
Transforms committed meta-data of compiled Java classes of the modules of the instance. |
|
void |
transformClasses(org.jomc.model.Module module,
javax.xml.bind.Marshaller marshaller,
javax.xml.bind.Unmarshaller unmarshaller,
File classesDirectory,
List<Transformer> transformers)
Transforms committed meta-data of compiled Java classes of a given module of the modules of the instance. |
|
void |
transformClasses(org.jomc.model.Specification specification,
javax.xml.bind.Marshaller marshaller,
javax.xml.bind.Unmarshaller unmarshaller,
org.apache.bcel.classfile.JavaClass javaClass,
List<Transformer> transformers)
Transforms committed meta-data of compiled Java classes of a given specification of the modules of the instance. |
|
org.jomc.model.ModelObjectValidationReport |
validateClasses(org.jomc.model.Implementation implementation,
javax.xml.bind.Unmarshaller unmarshaller,
org.apache.bcel.classfile.JavaClass javaClass)
Validates compiled Java classes against a given implementation of the modules of the instance. |
|
org.jomc.model.ModelObjectValidationReport |
validateClasses(org.jomc.model.Module module,
javax.xml.bind.Unmarshaller unmarshaller,
ClassLoader classLoader)
Validates compiled Java classes against a given module of the modules of the instance. |
|
org.jomc.model.ModelObjectValidationReport |
validateClasses(org.jomc.model.Module module,
javax.xml.bind.Unmarshaller unmarshaller,
File classesDirectory)
Validates compiled Java classes against a given module of the modules of the instance. |
|
org.jomc.model.ModelObjectValidationReport |
validateClasses(org.jomc.model.Specification specification,
javax.xml.bind.Unmarshaller unmarshaller,
org.apache.bcel.classfile.JavaClass javaClass)
Validates compiled Java classes against a given specification of the modules of the instance. |
|
org.jomc.model.ModelObjectValidationReport |
validateClasses(javax.xml.bind.Unmarshaller unmarshaller,
ClassLoader classLoader)
Validates compiled Java classes against the modules of the instance. |
|
org.jomc.model.ModelObjectValidationReport |
validateClasses(javax.xml.bind.Unmarshaller unmarshaller,
File classesDirectory)
Validates compiled Java classes against 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(javax.xml.bind.Marshaller marshaller,
File classesDirectory)
throws IOException
marshaller - The marshaller to use for committing the classes.classesDirectory - The directory holding the compiled class files.
NullPointerException - if marshaller or classesDirectory is null.
IOException - if committing meta-data fails.commitClasses(org.jomc.model.Module, javax.xml.bind.Marshaller, java.io.File)
public void commitClasses(org.jomc.model.Module module,
javax.xml.bind.Marshaller marshaller,
File classesDirectory)
throws IOException
module - The module to process.marshaller - The marshaller to use for committing the classes.classesDirectory - The directory holding the compiled class files.
NullPointerException - if module, marshaller or classesDirectory is null.
IOException - if committing meta-data fails.commitClasses(org.jomc.model.Specification, javax.xml.bind.Marshaller, java.io.File),
commitClasses(org.jomc.model.Implementation, javax.xml.bind.Marshaller, java.io.File)
public void commitClasses(org.jomc.model.Specification specification,
javax.xml.bind.Marshaller marshaller,
File classesDirectory)
throws IOException
specification - The specification to process.marshaller - The marshaller to use for committing the classes.classesDirectory - The directory holding the compiled class files.
NullPointerException - if specification, marshaller or classesDirectory is
null.
IOException - if committing meta-data fails.
public void commitClasses(org.jomc.model.Implementation implementation,
javax.xml.bind.Marshaller marshaller,
File classesDirectory)
throws IOException
implementation - The implementation to process.marshaller - The marshaller to use for committing the classes.classesDirectory - The directory holding the compiled class files.
NullPointerException - if implementation, marshaller or classesDirectory is
null.
IOException - if committing meta-data fails.
public org.jomc.model.ModelObjectValidationReport validateClasses(javax.xml.bind.Unmarshaller unmarshaller,
File classesDirectory)
throws IOException
unmarshaller - The unmarshaller to use for validating classes.classesDirectory - The directory holding the compiled class files.
NullPointerException - if unmarshaller or classesDirectory is null.
IOException - if reading class files fails.validateClasses(org.jomc.model.Module, javax.xml.bind.Unmarshaller, java.io.File)
public org.jomc.model.ModelObjectValidationReport validateClasses(javax.xml.bind.Unmarshaller unmarshaller,
ClassLoader classLoader)
throws IOException
unmarshaller - The unmarshaller to use for validating classes.classLoader - The class loader to search for classes.
NullPointerException - if unmarshaller or classLoader is null.
IOException - if reading class files fails.validateClasses(org.jomc.model.Module, javax.xml.bind.Unmarshaller, java.lang.ClassLoader)
public org.jomc.model.ModelObjectValidationReport validateClasses(org.jomc.model.Module module,
javax.xml.bind.Unmarshaller unmarshaller,
File classesDirectory)
throws IOException
module - The module to process.unmarshaller - The unmarshaller to use for validating classes.classesDirectory - The directory holding the compiled class files.
NullPointerException - if module, unmarshaller or classesDirectory is null.
IOException - if reading class files fails.validateClasses(org.jomc.model.Specification, javax.xml.bind.Unmarshaller, org.apache.bcel.classfile.JavaClass),
validateClasses(org.jomc.model.Implementation, javax.xml.bind.Unmarshaller, org.apache.bcel.classfile.JavaClass)
public org.jomc.model.ModelObjectValidationReport validateClasses(org.jomc.model.Module module,
javax.xml.bind.Unmarshaller unmarshaller,
ClassLoader classLoader)
throws IOException
module - The module to process.unmarshaller - The unmarshaller to use for validating classes.classLoader - The class loader to search for classes.
NullPointerException - if module, unmarshaller or classLoader is null.
IOException - if reading class files fails.validateClasses(org.jomc.model.Specification, javax.xml.bind.Unmarshaller, org.apache.bcel.classfile.JavaClass),
validateClasses(org.jomc.model.Implementation, javax.xml.bind.Unmarshaller, org.apache.bcel.classfile.JavaClass)
public org.jomc.model.ModelObjectValidationReport validateClasses(org.jomc.model.Specification specification,
javax.xml.bind.Unmarshaller unmarshaller,
org.apache.bcel.classfile.JavaClass javaClass)
throws IOException
specification - The specification to process.unmarshaller - The unmarshaller to use for validating classes.javaClass - The class to validate.
NullPointerException - if specification, unmarshaller or javaClass is null.
IOException - if reading class files fails.
public org.jomc.model.ModelObjectValidationReport validateClasses(org.jomc.model.Implementation implementation,
javax.xml.bind.Unmarshaller unmarshaller,
org.apache.bcel.classfile.JavaClass javaClass)
throws IOException
implementation - The implementation to process.unmarshaller - The unmarshaller to use for validating classes.javaClass - The class to validate.
NullPointerException - if implementation, unmarshaller or javaClass is
null.
IOException - if reading class files fails.
public void transformClasses(javax.xml.bind.Marshaller marshaller,
javax.xml.bind.Unmarshaller unmarshaller,
File classesDirectory,
List<Transformer> transformers)
throws IOException,
TransformerException
marshaller - The marshaller to use for transforming classes.unmarshaller - The unmarshaller to use for transforming classes.classesDirectory - The directory holding the compiled class files.transformers - The transformers to use for transforming the classes.
NullPointerException - if marshaller, unmarshaller, classesDirectory or
transformers is null.
IOException - if accessing class files fails.
TransformerException - if transforming class files fails.transformClasses(org.jomc.model.Module, javax.xml.bind.Marshaller, javax.xml.bind.Unmarshaller, java.io.File, java.util.List)
public void transformClasses(org.jomc.model.Module module,
javax.xml.bind.Marshaller marshaller,
javax.xml.bind.Unmarshaller unmarshaller,
File classesDirectory,
List<Transformer> transformers)
throws IOException,
TransformerException
module - The module to process.marshaller - The marshaller to use for transforming classes.unmarshaller - The unmarshaller to use for transforming classes.classesDirectory - The directory holding the compiled class files.transformers - The transformers to use for transforming the classes.
NullPointerException - if module, marshaller, unmarshaller,
classesDirectory or transformers is null.
IOException - if accessing class files fails.
TransformerException - if transforming class files fails.transformClasses(org.jomc.model.Specification, javax.xml.bind.Marshaller, javax.xml.bind.Unmarshaller, org.apache.bcel.classfile.JavaClass, java.util.List),
transformClasses(org.jomc.model.Implementation, javax.xml.bind.Marshaller, javax.xml.bind.Unmarshaller, org.apache.bcel.classfile.JavaClass, java.util.List)
public void transformClasses(org.jomc.model.Specification specification,
javax.xml.bind.Marshaller marshaller,
javax.xml.bind.Unmarshaller unmarshaller,
org.apache.bcel.classfile.JavaClass javaClass,
List<Transformer> transformers)
throws IOException,
TransformerException
specification - The specification to process.marshaller - The marshaller to use for transforming classes.unmarshaller - The unmarshaller to use for transforming classes.javaClass - The java class to process.transformers - The transformers to use for transforming the classes.
NullPointerException - if specification, marshaller, unmarshaller,
javaClass or transformers is null.
IOException - if accessing class files fails.
TransformerException - if transforming class files fails.
public void transformClasses(org.jomc.model.Implementation implementation,
javax.xml.bind.Marshaller marshaller,
javax.xml.bind.Unmarshaller unmarshaller,
org.apache.bcel.classfile.JavaClass javaClass,
List<Transformer> transformers)
throws TransformerException,
IOException
implementation - The implementation to process.marshaller - The marshaller to use for transforming classes.unmarshaller - The unmarshaller to use for transforming classes.javaClass - The java class to process.transformers - The transformers to use for transforming the classes.
NullPointerException - if implementation, marshaller, unmarshaller,
javaClass or transformers is null.
IOException - if accessing class files fails.
TransformerException - if transforming class files fails.
public org.apache.bcel.classfile.JavaClass getJavaClass(File classFile)
throws IOException
classFile - The class file to parse.
NullPointerException - if classFile is null.
IOException - if parsing classFile fails.JavaClass
public org.apache.bcel.classfile.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.JavaClass
public org.apache.bcel.classfile.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.JavaClass
public byte[] getClassfileAttribute(org.apache.bcel.classfile.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.JavaClass.getAttributes()
public void setClassfileAttribute(org.apache.bcel.classfile.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.JavaClass.getAttributes()
public byte[] encodeModelObject(javax.xml.bind.Marshaller marshaller,
javax.xml.bind.JAXBElement<? extends org.jomc.model.ModelObject> modelObject)
throws IOException
marshaller - The marshaller to use for encoding the object.modelObject - The model object to encode.
modelObject.
NullPointerException - if marshaller or modelObject is null.
IOException - if encoding modelObject fails.
public <T extends org.jomc.model.ModelObject> T decodeModelObject(javax.xml.bind.Unmarshaller unmarshaller,
byte[] bytes,
Class<T> type)
throws IOException
T - The type of the decoded model object.unmarshaller - The unmarshaller to use for decoding the object.bytes - The encoded model object to decode.type - The type of the encoded model object.
bytes.
NullPointerException - if unmarshaller, bytes or type is null.
IOException - if decoding bytes fails.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||