Class JField
java.lang.Object
org.codehaus.modello.plugin.java.javasource.JField
- All Implemented Interfaces:
JMember
A class which holds information about a field.
Modelled closely after the Java Reflection API.
This class is part of package which is used to
create source code in memory.
- Version:
- $Revision$ $Date$
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate JAnnotationsprivate JDocCommentprivate JClassThe Class in this JField has been declaredprivate Stringprivate JModifiersThe set of modifiers for this JFieldprivate Stringprivate JType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendAnnotation(String annotation) Returns the comment describing this member.Returns the class in which this JField has been declaredReturns the initialization String for this JFieldReturns the modifiers for this JFieldgetName()Returns the name of this JFieldgetType()Returns the JType represting the type of this JFieldvoidsetAnnotations(JAnnotations annotations) voidsetComment(String comment) Sets the comment describing this member.voidsetComment(JDocComment comment) Sets the comment describing this member.protected voidsetDeclaringClass(JClass declaringClass) voidsetInitString(String init) Sets the initialization string for this JField; Allows some flexibility in declaring default values.voidsetModifiers(JModifiers modifiers) voidSets the name of this JFieldtoString()
-
Field Details
-
modifiers
The set of modifiers for this JField -
type
-
name
-
comment
-
initString
-
annotations
-
declaringClass
The Class in this JField has been declared
-
-
Constructor Details
-
JField
-
-
Method Details
-
getComment
Returns the comment describing this member.- Returns:
- the comment describing this member, or null if no comment has been set.
-
getDeclaringClass
Returns the class in which this JField has been declared- Returns:
- the class in which this JField has been declared
-
getInitString
Returns the initialization String for this JField- Returns:
- the initialization String for this JField, or null if no initialization String was specified.
-
getModifiers
Returns the modifiers for this JField- Specified by:
getModifiersin interfaceJMember- Returns:
- the modifiers for this JField
-
getName
Returns the name of this JField -
getType
Returns the JType represting the type of this JField- Returns:
- the JClass represting the type of this JField
-
setComment
Sets the comment describing this member.- Parameters:
comment- the JDocComment for this member
-
setComment
Sets the comment describing this member.- Parameters:
comment- the JDocComment for this member
-
setInitString
Sets the initialization string for this JField; Allows some flexibility in declaring default values.- Parameters:
init- the initialization string for this member.
-
setName
Sets the name of this JField- Parameters:
name- the name of this JField- Throws:
IllegalArgumentException- when the name is not a valid Java member name, or if a member with the given name already exists in the declaring class
-
setModifiers
-
setDeclaringClass
-
toString
-
getAnnotations
- Specified by:
getAnnotationsin interfaceJMember- Returns:
- the annotations
-
appendAnnotation
- Parameters:
annotation- the annotation to append
-
setAnnotations
- Parameters:
annotations- the annotations to set
-