org.fuin.srcgen4javassist
Class SgVariable

java.lang.Object
  extended by org.fuin.srcgen4javassist.SgVariable
Direct Known Subclasses:
SgArgument, SgField

public abstract class SgVariable
extends Object

Base class for fields and arguments.


Constructor Summary
SgVariable(String modifiers, SgClass type, String name)
          Constructor with modifiers, class and name.
 
Method Summary
 void addAnnotation(SgAnnotation annotation)
          Adds an annotation.
 void addAnnotations(List<SgAnnotation> annotations)
          Adds a list of annotations.
 List<SgAnnotation> getAnnotations()
          Returns the annotations for this field.
 String getModifiers()
          Returns the modifiers.
 String getName()
          Returns the name.
 SgClass getType()
          Returns the type of the field.
 boolean hasAnnotation(String name)
          Checks if a given annotation is in the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SgVariable

public SgVariable(String modifiers,
                  SgClass type,
                  String name)
Constructor with modifiers, class and name.

Parameters:
modifiers - Modifiers (separated by space) - Cannot be null (but empty).
type - Type of the field - Cannot be null.
name - Name of the field - Cannot be null.
Method Detail

getModifiers

public final String getModifiers()
Returns the modifiers.

Returns:
Modifiers (separated by space) - Always non-null.

getType

public final SgClass getType()
Returns the type of the field.

Returns:
Type of the field - Always non-null.

getName

public final String getName()
Returns the name.

Returns:
Name of the field - Always non-null.

getAnnotations

public final List<SgAnnotation> getAnnotations()
Returns the annotations for this field.

Returns:
List of annotations - Always non-null and unmodifiable.

addAnnotation

public final void addAnnotation(SgAnnotation annotation)
Adds an annotation.

Parameters:
annotation - Annotation to add - Cannot be null.

addAnnotations

public final void addAnnotations(List<SgAnnotation> annotations)
Adds a list of annotations. The internal list will not be cleared! The annotations will simply be added with addAll(..).

Parameters:
annotations - Annotations to add - Cannot be null.

hasAnnotation

public final boolean hasAnnotation(String name)
Checks if a given annotation is in the list.

Parameters:
name - Name of the annotation to find - Cannot be null.
Returns:
If it's found true else false.


Copyright © 2011 Future Invent Informationsmanagement GmbH. All Rights Reserved.