Class JField
java.lang.Object
org.codehaus.modello.plugin.java.javasource.JField
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$
- Author:
- Keith Visco
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
appendAnnotation
(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 JFieldvoid
setAnnotations
(JAnnotations annotations) void
setComment
(String comment) Sets the comment describing this member.void
setComment
(JDocComment comment) Sets the comment describing this member.protected void
setDeclaringClass
(JClass declaringClass) void
setInitString
(String init) Sets the initialization string for this JField; Allows some flexibility in declaring default values.void
setModifiers
(JModifiers modifiers) void
Sets the name of this JFieldtoString()
-
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- Returns:
- the modifiers for this JField
-
getName
Returns the name of this JField- 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
- Returns:
- the annotations
-
appendAnnotation
- Parameters:
annotation
- the annotation to append
-
setAnnotations
- Parameters:
annotations
- the annotations to set
-