public abstract class ClassModel
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private org.jboss.jdeparser.JClassDef |
classDef |
private java.lang.String |
className |
private java.lang.String |
format |
private static java.lang.String |
GET_INSTANCE_METHOD_NAME |
private static java.lang.String |
INSTANCE_FIELD_NAME |
private java.util.Map<java.lang.String,org.jboss.jdeparser.JVarDeclaration> |
messageFields |
private MessageInterface |
messageInterface |
private java.util.Map<java.lang.String,org.jboss.jdeparser.JMethodDef> |
messageMethods |
protected org.jboss.jdeparser.JSourceFile |
sourceFile |
private org.jboss.jdeparser.JSources |
sources |
private java.lang.String |
superClassName |
Constructor and Description |
---|
ClassModel(javax.annotation.processing.Filer filer,
MessageInterface messageInterface,
java.lang.String className,
java.lang.String superClassName)
Construct a class model.
|
Modifier and Type | Method and Description |
---|---|
(package private) org.jboss.jdeparser.JMethodDef |
addMessageMethod(MessageMethod messageMethod)
Adds a method to return the message value.
|
(package private) org.jboss.jdeparser.JMethodDef |
addMessageMethod(MessageMethod messageMethod,
java.lang.String messageValue)
Adds a method to return the message value.
|
protected org.jboss.jdeparser.JMethodDef |
createReadResolveMethod()
Creates the read resolve method and instance field.
|
void |
generateAndWrite()
Writes the generated source file to the file system.
|
(package private) org.jboss.jdeparser.JClassDef |
generateModel()
Generate the code corresponding to this
class model
|
MessageInterface |
messageInterface()
Returns the message interface being used.
|
java.lang.String |
qualifiedClassName()
Get the class name.
|
private static final java.lang.String INSTANCE_FIELD_NAME
private static final java.lang.String GET_INSTANCE_METHOD_NAME
private final org.jboss.jdeparser.JSources sources
private final org.jboss.jdeparser.JClassDef classDef
protected final org.jboss.jdeparser.JSourceFile sourceFile
private final MessageInterface messageInterface
private final java.lang.String className
private final java.lang.String superClassName
private final java.lang.String format
private final java.util.Map<java.lang.String,org.jboss.jdeparser.JMethodDef> messageMethods
private final java.util.Map<java.lang.String,org.jboss.jdeparser.JVarDeclaration> messageFields
ClassModel(javax.annotation.processing.Filer filer, MessageInterface messageInterface, java.lang.String className, java.lang.String superClassName)
filer
- the filer used to create the source filemessageInterface
- the message interface to implement.superClassName
- the super class used for the translation implementations.public final MessageInterface messageInterface()
public final void generateAndWrite() throws java.io.IOException
java.io.IOException
- if the file could not be writtenorg.jboss.jdeparser.JClassDef generateModel() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the class has already been defined.org.jboss.jdeparser.JMethodDef addMessageMethod(MessageMethod messageMethod)
org.jboss.logging.Message
. This method will
be appended with $str
.
If the message method has already been defined the previously created method is returned.
messageMethod
- the message methodjava.lang.IllegalStateException
- if this method is called before the generateModel methodorg.jboss.jdeparser.JMethodDef addMessageMethod(MessageMethod messageMethod, java.lang.String messageValue)
org.jboss.logging.Message
. This method will
be appended with $str
.
If the message method has already been defined the previously created method is returned.
messageMethod
- the message method.messageValue
- the message value.java.lang.IllegalStateException
- if this method is called before the generateModel methodpublic final java.lang.String qualifiedClassName()
protected org.jboss.jdeparser.JMethodDef createReadResolveMethod()