jaxx.compiler.java
Class JavaField

java.lang.Object
  extended by jaxx.compiler.java.JavaElement
      extended by jaxx.compiler.java.JavaField
All Implemented Interfaces:
Comparable<JavaField>

public class JavaField
extends JavaElement
implements Comparable<JavaField>

Represents a field in a Java source file being generated for output. JavaFields are created and added to a JavaFile, which can then output Java source code.


Nested Class Summary
static class JavaField.FieldOrder
           
 
Field Summary
 
Fields inherited from class jaxx.compiler.java.JavaElement
JavaElementComparator
 
Constructor Summary
JavaField(int modifiers, String type, String name, boolean override)
          Constructs a new JavaField.
JavaField(int modifiers, String type, String name, boolean override, String initializer)
          Constructs a new JavaField.
 
Method Summary
 int compareTo(JavaField o)
           
static EnumSet<JavaField.FieldOrder> getFieldOrderScope(EnumSet<JavaField.FieldOrder> allConstants, int scope)
           
 String getInitializer()
           
static EnumMap<JavaField.FieldOrder,List<JavaField>> getSortedFields(List<JavaField> fields)
           
 String getType()
          Returns the field's type, as it would be represented in Java source code.
 boolean isOverride()
           
 String toString()
           
 
Methods inherited from class jaxx.compiler.java.JavaElement
addAnnotation, getAnnotations, getModifiers, getModifiersText, getName, hasAnnotations, setModifiers, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JavaField

public JavaField(int modifiers,
                 String type,
                 String name,
                 boolean override)
Constructs a new JavaField. The modifiers parameter is a bit mask of the constants from Modifier, and the type of the field should be represented as it would appear in Java source code.

Parameters:
modifiers - the modifier keywords that should appear as part of the field's declaration
type - the type of the field as it would appear in Java source code
name - the field's name
override - flag to add @Override annotation on getter and setter

JavaField

public JavaField(int modifiers,
                 String type,
                 String name,
                 boolean override,
                 String initializer)
Constructs a new JavaField. The modifiers parameter is a bit mask of the constants from java.lang.reflect.Modifier, and the type of the field should be represented as it would appear in Java source code. The initializer is the initial value of the field as it would appear in Java source code, or null to leave it at the default value.

Parameters:
modifiers - the modifier keywords that should appear as part of the field's declaration
type - the type of the field as it would appear in Java source code
name - the field's name
override - true if method should be marked as overriden
initializer - the initial value of the field, as it would appear in Java source code
Method Detail

getType

public String getType()
Returns the field's type, as it would be represented in Java source code.

Returns:
the field's type

isOverride

public boolean isOverride()

getInitializer

public String getInitializer()

compareTo

public int compareTo(JavaField o)
Specified by:
compareTo in interface Comparable<JavaField>

toString

public String toString()
Overrides:
toString in class Object

getSortedFields

public static EnumMap<JavaField.FieldOrder,List<JavaField>> getSortedFields(List<JavaField> fields)

getFieldOrderScope

public static EnumSet<JavaField.FieldOrder> getFieldOrderScope(EnumSet<JavaField.FieldOrder> allConstants,
                                                               int scope)


Copyright © 2008-2011 CodeLutin. All Rights Reserved.