Class JField
- java.lang.Object
-
- org.codehaus.modello.plugin.java.javasource.JField
-
-
Field Summary
Fields Modifier and Type Field Description private JAnnotations
annotations
private JDocComment
comment
private JClass
declaringClass
The Class in this JField has been declaredprivate java.lang.String
initString
private JModifiers
modifiers
The set of modifiers for this JFieldprivate java.lang.String
name
private JType
type
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendAnnotation(java.lang.String annotation)
JAnnotations
getAnnotations()
JDocComment
getComment()
Returns the comment describing this member.JClass
getDeclaringClass()
Returns the class in which this JField has been declaredjava.lang.String
getInitString()
Returns the initialization String for this JFieldJModifiers
getModifiers()
Returns the modifiers for this JFieldjava.lang.String
getName()
Returns the name of this JFieldJType
getType()
Returns the JType represting the type of this JFieldvoid
setAnnotations(JAnnotations annotations)
void
setComment(java.lang.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(java.lang.String init)
Sets the initialization string for this JField; Allows some flexibility in declaring default values.void
setModifiers(JModifiers modifiers)
void
setName(java.lang.String name)
Sets the name of this JFieldjava.lang.String
toString()
-
-
-
Field Detail
-
modifiers
private JModifiers modifiers
The set of modifiers for this JField
-
type
private JType type
-
name
private java.lang.String name
-
comment
private JDocComment comment
-
initString
private java.lang.String initString
-
annotations
private JAnnotations annotations
-
declaringClass
private JClass declaringClass
The Class in this JField has been declared
-
-
Constructor Detail
-
JField
public JField(JType type, java.lang.String name)
-
-
Method Detail
-
getComment
public JDocComment getComment()
Returns the comment describing this member.- Returns:
- the comment describing this member, or null if no comment has been set.
-
getDeclaringClass
public JClass getDeclaringClass()
Returns the class in which this JField has been declared- Returns:
- the class in which this JField has been declared
-
getInitString
public java.lang.String getInitString()
Returns the initialization String for this JField- Returns:
- the initialization String for this JField, or null if no initialization String was specified.
-
getModifiers
public JModifiers getModifiers()
Returns the modifiers for this JField- Specified by:
getModifiers
in interfaceJMember
- Returns:
- the modifiers for this JField
-
getName
public java.lang.String getName()
Returns the name of this JField
-
getType
public JType getType()
Returns the JType represting the type of this JField- Returns:
- the JClass represting the type of this JField
-
setComment
public void setComment(JDocComment comment)
Sets the comment describing this member.- Parameters:
comment
- the JDocComment for this member
-
setComment
public void setComment(java.lang.String comment)
Sets the comment describing this member.- Parameters:
comment
- the JDocComment for this member
-
setInitString
public void setInitString(java.lang.String init)
Sets the initialization string for this JField; Allows some flexibility in declaring default values.- Parameters:
init
- the initialization string for this member.
-
setName
public void setName(java.lang.String name) throws java.lang.IllegalArgumentException
Sets the name of this JField- Parameters:
name
- the name of this JField- Throws:
java.lang.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
public void setModifiers(JModifiers modifiers)
-
setDeclaringClass
protected void setDeclaringClass(JClass declaringClass)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getAnnotations
public JAnnotations getAnnotations()
- Specified by:
getAnnotations
in interfaceJMember
- Returns:
- the annotations
-
appendAnnotation
public void appendAnnotation(java.lang.String annotation)
- Parameters:
annotation
- the annotation to append
-
setAnnotations
public void setAnnotations(JAnnotations annotations)
- Parameters:
annotations
- the annotations to set
-
-