|
||||||||||
| 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.ClassFileProcessor
public class ClassFileProcessor
Processes class files.
Use cases
commitModelObjects(Marshaller, File)commitModelObjects(Module, Marshaller, File)commitModelObjects(Specification, Marshaller, File)commitModelObjects(Implementation, Marshaller, File)validateModelObjects(Unmarshaller, File)validateModelObjects(Unmarshaller, ClassLoader)validateModelObjects(Module, Unmarshaller, File)validateModelObjects(Module, Unmarshaller, ClassLoader)validateModelObjects(Specification, Unmarshaller, JavaClass)validateModelObjects(Implementation, Unmarshaller, JavaClass)transformModelObjects(Marshaller, Unmarshaller, File, List)transformModelObjects(Module, Marshaller, Unmarshaller, File, List)transformModelObjects(Specification, Marshaller, Unmarshaller, JavaClass, List)transformModelObjects(Implementation, Marshaller, Unmarshaller, JavaClass, List)
JomcTool.getModules()| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.jomc.tools.JomcTool |
|---|
JomcTool.Listener |
| Constructor Summary | |
|---|---|
ClassFileProcessor()
Creates a new ClassFileProcessor instance. |
|
ClassFileProcessor(ClassFileProcessor tool)
Creates a new ClassFileProcessor instance taking a ClassFileProcessor instance to initialize the
instance with. |
|
| Method Summary | ||
|---|---|---|
void |
commitModelObjects(org.jomc.model.Implementation implementation,
javax.xml.bind.Marshaller marshaller,
File classesDirectory)
Commits model objects of a given implementation of the modules of the instance to class files. |
|
void |
commitModelObjects(javax.xml.bind.Marshaller marshaller,
File classesDirectory)
Commits model objects of the modules of the instance to class files. |
|
void |
commitModelObjects(org.jomc.model.Module module,
javax.xml.bind.Marshaller marshaller,
File classesDirectory)
Commits model objects of a given module of the modules of the instance to class files. |
|
void |
commitModelObjects(org.jomc.model.Specification specification,
javax.xml.bind.Marshaller marshaller,
File classesDirectory)
Commits model objects of a given specification of the modules of the instance to class files. |
|
|
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 |
transformModelObjects(org.jomc.model.Implementation implementation,
javax.xml.bind.Marshaller marshaller,
javax.xml.bind.Unmarshaller unmarshaller,
org.apache.bcel.classfile.JavaClass classFile,
List<Transformer> transformers)
Transforms model objects of class files. |
|
void |
transformModelObjects(javax.xml.bind.Marshaller marshaller,
javax.xml.bind.Unmarshaller unmarshaller,
File classesDirectory,
List<Transformer> transformers)
Transforms model objects of class files. |
|
void |
transformModelObjects(org.jomc.model.Module module,
javax.xml.bind.Marshaller marshaller,
javax.xml.bind.Unmarshaller unmarshaller,
File classesDirectory,
List<Transformer> transformers)
Transforms model objects of class files. |
|
void |
transformModelObjects(org.jomc.model.Specification specification,
javax.xml.bind.Marshaller marshaller,
javax.xml.bind.Unmarshaller unmarshaller,
org.apache.bcel.classfile.JavaClass classFile,
List<Transformer> transformers)
Transforms model objects of class files. |
|
org.jomc.model.ModelValidationReport |
validateModelObjects(org.jomc.model.Implementation implementation,
javax.xml.bind.Unmarshaller unmarshaller,
org.apache.bcel.classfile.JavaClass classFile)
Validates model objects of class files. |
|
org.jomc.model.ModelValidationReport |
validateModelObjects(org.jomc.model.Module module,
javax.xml.bind.Unmarshaller unmarshaller,
ClassLoader classLoader)
Validates model objects of class files. |
|
org.jomc.model.ModelValidationReport |
validateModelObjects(org.jomc.model.Module module,
javax.xml.bind.Unmarshaller unmarshaller,
File classesDirectory)
Validates model objects of class files. |
|
org.jomc.model.ModelValidationReport |
validateModelObjects(org.jomc.model.Specification specification,
javax.xml.bind.Unmarshaller unmarshaller,
org.apache.bcel.classfile.JavaClass classFile)
Validates model objects of class files. |
|
org.jomc.model.ModelValidationReport |
validateModelObjects(javax.xml.bind.Unmarshaller unmarshaller,
ClassLoader classLoader)
Validates model objects of class files. |
|
org.jomc.model.ModelValidationReport |
validateModelObjects(javax.xml.bind.Unmarshaller unmarshaller,
File classesDirectory)
Validates model objects of class files. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ClassFileProcessor()
ClassFileProcessor instance.
public ClassFileProcessor(ClassFileProcessor tool)
throws IOException
ClassFileProcessor instance taking a ClassFileProcessor instance to initialize the
instance with.
tool - The instance to initialize the new instance with,
NullPointerException - if tool is null.
IOException - if copying tool fails.| Method Detail |
|---|
public void commitModelObjects(javax.xml.bind.Marshaller marshaller,
File classesDirectory)
throws IOException
marshaller - The marshaller to use for committing the model objects.classesDirectory - The directory holding the class files.
NullPointerException - if marshaller or classesDirectory is null.
IOException - if committing model objects fails.commitModelObjects(org.jomc.model.Module, javax.xml.bind.Marshaller, java.io.File),
ModelContext.createMarshaller()
public void commitModelObjects(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 model objects.classesDirectory - The directory holding the class files.
NullPointerException - if module, marshaller or classesDirectory is null.
IOException - if committing model objects fails.commitModelObjects(org.jomc.model.Specification, javax.xml.bind.Marshaller, java.io.File),
commitModelObjects(org.jomc.model.Implementation, javax.xml.bind.Marshaller, java.io.File),
ModelContext.createMarshaller()
public void commitModelObjects(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 model objects.classesDirectory - The directory holding the class files.
NullPointerException - if specification, marshaller or classesDirectory is
null.
IOException - if committing model objects fails.ModelContext.createMarshaller()
public void commitModelObjects(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 model objects.classesDirectory - The directory holding the class files.
NullPointerException - if implementation, marshaller or classesDirectory is
null.
IOException - if committing model objects fails.ModelContext.createMarshaller()
public org.jomc.model.ModelValidationReport validateModelObjects(javax.xml.bind.Unmarshaller unmarshaller,
File classesDirectory)
throws IOException
unmarshaller - The unmarshaller to use for validating model objects.classesDirectory - The directory holding the class files.
NullPointerException - if unmarshaller or classesDirectory is null.
IOException - if validating model objects fails.validateModelObjects(org.jomc.model.Module, javax.xml.bind.Unmarshaller, java.io.File),
ModelContext.createUnmarshaller()
public org.jomc.model.ModelValidationReport validateModelObjects(javax.xml.bind.Unmarshaller unmarshaller,
ClassLoader classLoader)
throws IOException
unmarshaller - The unmarshaller to use for validating model objects.classLoader - The class loader to search for class files.
NullPointerException - if unmarshaller or classLoader is null.
IOException - if validating model objects fails.validateModelObjects(org.jomc.model.Module, javax.xml.bind.Unmarshaller, java.lang.ClassLoader),
ModelContext.createUnmarshaller()
public org.jomc.model.ModelValidationReport validateModelObjects(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 model objects.classesDirectory - The directory holding the class files.
NullPointerException - if module, unmarshaller or classesDirectory is null.
IOException - if validating model objects fails.validateModelObjects(org.jomc.model.Specification, javax.xml.bind.Unmarshaller, org.apache.bcel.classfile.JavaClass),
validateModelObjects(org.jomc.model.Implementation, javax.xml.bind.Unmarshaller, org.apache.bcel.classfile.JavaClass),
ModelContext.createUnmarshaller()
public org.jomc.model.ModelValidationReport validateModelObjects(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 model objects.classLoader - The class loader to search for class files.
NullPointerException - if module, unmarshaller or classLoader is null.
IOException - if validating model objects fails.validateModelObjects(org.jomc.model.Specification, javax.xml.bind.Unmarshaller, org.apache.bcel.classfile.JavaClass),
validateModelObjects(org.jomc.model.Implementation, javax.xml.bind.Unmarshaller, org.apache.bcel.classfile.JavaClass),
ModelContext.createUnmarshaller()
public org.jomc.model.ModelValidationReport validateModelObjects(org.jomc.model.Specification specification,
javax.xml.bind.Unmarshaller unmarshaller,
org.apache.bcel.classfile.JavaClass classFile)
throws IOException
specification - The specification to process.unmarshaller - The unmarshaller to use for validating model objects.classFile - The class file to validate model objects of.
NullPointerException - if specification, unmarshaller or classFile is null.
IOException - if validating model objects fails.ModelContext.createUnmarshaller()
public org.jomc.model.ModelValidationReport validateModelObjects(org.jomc.model.Implementation implementation,
javax.xml.bind.Unmarshaller unmarshaller,
org.apache.bcel.classfile.JavaClass classFile)
throws IOException
implementation - The implementation to process.unmarshaller - The unmarshaller to use for validating model objects.classFile - The class file to validate model objects of.
NullPointerException - if implementation, unmarshaller or classFile is null.
IOException - if validating model objects fails.ModelContext.createUnmarshaller()
public void transformModelObjects(javax.xml.bind.Marshaller marshaller,
javax.xml.bind.Unmarshaller unmarshaller,
File classesDirectory,
List<Transformer> transformers)
throws IOException
marshaller - The marshaller to use for transforming model objects.unmarshaller - The unmarshaller to use for transforming model objects.classesDirectory - The directory holding the class files.transformers - The transformers to use for transforming model objects.
NullPointerException - if marshaller, unmarshaller, classesDirectory or
transformers is null.
IOException - if transforming model objects fails.transformModelObjects(org.jomc.model.Module, javax.xml.bind.Marshaller, javax.xml.bind.Unmarshaller, java.io.File, java.util.List),
ModelContext.createMarshaller(),
ModelContext.createUnmarshaller()
public void transformModelObjects(org.jomc.model.Module module,
javax.xml.bind.Marshaller marshaller,
javax.xml.bind.Unmarshaller unmarshaller,
File classesDirectory,
List<Transformer> transformers)
throws IOException
module - The module to process.marshaller - The marshaller to use for transforming model objects.unmarshaller - The unmarshaller to use for transforming model objects.classesDirectory - The directory holding the class files.transformers - The transformers to use for transforming the model objects.
NullPointerException - if module, marshaller, unmarshaller,
classesDirectory or transformers is null.
IOException - if transforming model objects fails.transformModelObjects(org.jomc.model.Specification, javax.xml.bind.Marshaller, javax.xml.bind.Unmarshaller, org.apache.bcel.classfile.JavaClass, java.util.List),
transformModelObjects(org.jomc.model.Implementation, javax.xml.bind.Marshaller, javax.xml.bind.Unmarshaller, org.apache.bcel.classfile.JavaClass, java.util.List),
ModelContext.createMarshaller(),
ModelContext.createUnmarshaller()
public void transformModelObjects(org.jomc.model.Specification specification,
javax.xml.bind.Marshaller marshaller,
javax.xml.bind.Unmarshaller unmarshaller,
org.apache.bcel.classfile.JavaClass classFile,
List<Transformer> transformers)
throws IOException
specification - The specification to process.marshaller - The marshaller to use for transforming model objects.unmarshaller - The unmarshaller to use for transforming model objects.classFile - The class file to transform model objects of.transformers - The transformers to use for transforming the model objects.
NullPointerException - if specification, marshaller, unmarshaller,
classFile or transformers is null.
IOException - if transforming model objects fails.ModelContext.createMarshaller(),
ModelContext.createUnmarshaller()
public void transformModelObjects(org.jomc.model.Implementation implementation,
javax.xml.bind.Marshaller marshaller,
javax.xml.bind.Unmarshaller unmarshaller,
org.apache.bcel.classfile.JavaClass classFile,
List<Transformer> transformers)
throws IOException
implementation - The implementation to process.marshaller - The marshaller to use for transforming model objects.unmarshaller - The unmarshaller to use for transforming model objects.classFile - The class file to transform model objects of.transformers - The transformers to use for transforming the model objects.
NullPointerException - if implementation, marshaller, unmarshaller,
classFile or transformers is null.
IOException - if transforming model objects fails.ModelContext.createMarshaller(),
ModelContext.createUnmarshaller()
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 | |||||||||