Package org.exolab.javasource
Class AbstractJField
java.lang.Object
org.exolab.javasource.JAnnotatedElementHelper
org.exolab.javasource.AbstractJField
- All Implemented Interfaces:
JAnnotatedElement
,JMember
A (abstract) base class which holds information about fields. Modeled closely after the
Java Reflection API. This class is part of package which is used to create
source code in memory.
- Since:
- 1.3
- Author:
- Werner Guttmann
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the JavaDoc comment describing this member.Returns the class in which this JField has been declared.Returns the initialization String for this JField.Returns the modifiers for this JField.getName()
Returns the name of this JField.getType()
Returns the JType representing the type of this JField.boolean
Indicates whether this JField instance represents a field of type date/time.void
setComment
(String comment) Sets the JavaDoc comment describing this JField.void
setComment
(JDocComment comment) Sets the JavaDoc comment describing this JField.void
setDateTime
(boolean isDateTime) To indicate whether this JField instance represents a field of type date/time.protected void
setDeclaringClass
(JClass declaringClass) Sets the class that declares this JField.void
setInitString
(String init) Sets the initialization string for this JField.void
setModifiers
(JModifiers modifiers) Sets the access modifiers on this JField.void
Sets the name of this JField.toString()
Methods inherited from class org.exolab.javasource.JAnnotatedElementHelper
addAnnotation, getAnnotation, getAnnotations, hasAnnotations, isAnnotationPresent, printAnnotations, removeAnnotation
-
Constructor Details
-
AbstractJField
Creates a new JField.- Parameters:
type
- JType of this new field.name
- Name of this new field.
-
-
Method Details
-
getComment
Returns the JavaDoc comment describing this member.- Returns:
- The JavaDoc 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:
getModifiers
in interfaceJMember
- Returns:
- The modifiers for this JField.
-
getName
Returns the name of this JField. -
getType
Returns the JType representing the type of this JField.- Returns:
- The JType representing the type of this JField.
-
setComment
Sets the JavaDoc comment describing this JField.- Parameters:
comment
- The JavaDoc comment for this JField.
-
setComment
Sets the JavaDoc comment describing this JField.- Parameters:
comment
- The JavaDoc comment for this JField.
-
setInitString
Sets the initialization string for this JField. This 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.
-
setModifiers
Sets the access modifiers on this JField.- Parameters:
modifiers
- The access modifiers to be used for this JField.
-
setDeclaringClass
Sets the class that declares this JField.- Parameters:
declaringClass
- The class in which this Jfield is declared.
-
isDateTime
public boolean isDateTime()Indicates whether this JField instance represents a field of type date/time.- Returns:
- True if this field is of type date/time.
-
setDateTime
public void setDateTime(boolean isDateTime) To indicate whether this JField instance represents a field of type date/time.- Parameters:
isDateTime
- True if this field is of type date/time.
-
toString
-