|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fuin.srcgen4javassist.SgClass
public final class SgClass
A class. TODO Add annotation handling
| Field Summary | |
|---|---|
static SgClass |
BOOLEAN
Simple "boolean" type. |
static SgClass |
BYTE
Simple "byte" type. |
static SgClass |
CHAR
Simple "char" type. |
static SgClass |
DOUBLE
Simple "double" type. |
static SgClass |
FLOAT
Simple "float" type. |
static SgClass |
INT
Simple "int" type. |
static SgClass |
LONG
Simple "long" type. |
static SgClass |
OBJECT
Base "Object" type. |
static SgClass |
SHORT
Simple "short" type. |
static SgClass |
VOID
Simple "void" type. |
| Constructor Summary | |
|---|---|
SgClass(java.lang.String packageName,
java.lang.String simpleName)
Basic constructor. |
|
SgClass(java.lang.String modifiers,
java.lang.String packageName,
java.lang.String simpleName,
boolean isinterface,
SgClass enclosingClass)
Constructor without super class. |
|
SgClass(java.lang.String modifiers,
java.lang.String packageName,
java.lang.String simpleName,
SgClass superClass,
boolean isinterface,
SgClass enclosingClass)
Constructor with super class. |
|
| Method Summary | |
|---|---|
void |
addAnnotation(SgAnnotation annotation)
Adds an annotation. |
void |
addAnnotations(java.util.List<SgAnnotation> annotations)
Adds a list of annotations. |
void |
addClass(SgClass clasz)
Adds an inner to this class. |
void |
addConstructor(SgConstructor constructor)
Adds a constructor to the class. |
void |
addField(SgField field)
Adds a field to the class. |
void |
addInterface(SgClass intf)
Add an interface to the class. |
void |
addMethod(SgMethod method)
Adds a method to the class. |
static SgClass |
create(SgClassPool pool,
java.lang.Class clasz)
Creates a model class by analyzing the "real" class. |
static SgClass |
create(SgClassPool pool,
java.lang.String className)
Creates a model class by loading the "real" class with Class.forName(..) |
SgClass |
findClassByName(java.lang.String name)
Find an inner class by it's name. |
SgField |
findFieldByName(java.lang.String name)
Find a field by it's name. |
SgMethod |
findMethodByName(java.lang.String name)
Find a method by it's name. |
java.util.List<SgAnnotation> |
getAnnotations()
Returns the annotations for this class. |
java.util.List<SgClass> |
getClasses()
Returns a list of all inner class. |
java.util.List<SgConstructor> |
getConstructors()
Returns a list of constructors. |
SgClass |
getEnclosingClass()
Returns the enclosing class. |
java.util.List<SgField> |
getFields()
Returns a list of all fields. |
java.util.List<SgClass> |
getInterfaces()
Returns a list of all interfaces. |
java.lang.String |
getInterfacesCommaSeparated()
Returns all (fully qualified) interface names. |
java.util.List<SgMethod> |
getMethods()
Returns a list of all methods. |
java.lang.String |
getModifiers()
Returns the modifiers as text. |
java.lang.String |
getName()
Returns the name of the class. |
java.lang.String |
getNameAsBinFilename()
Returns the package and name as a class filename. |
java.lang.String |
getNameAsFilename()
Returns the package and name as a filename without extension. |
java.lang.String |
getNameAsSrcFilename()
Returns the package and name as a source filename. |
static SgClass |
getNonPrimitiveClass(SgClassPool pool,
SgClass primitive)
Returns the corresponding class for a primitive. |
java.lang.String |
getPackageName()
Returns the package of the class. |
java.lang.String |
getSimpleName()
Returns the simple name of the class. |
java.lang.String |
getSimpleNameAsPackage()
Returns the simple name of the class with an "underscore" inserted before all upper case characters and all characters converted to lower case. |
java.lang.String |
getSourceName()
Returns the name of the class for use in source codes. |
SgClass |
getSuperClass()
Returns the super class. |
static java.lang.String |
getToPrimitiveMethod(SgClass clasz)
Returns the name of the conversion method to return a primitive type value from the following types: Boolean,
Byte, Character,
Short, Integer,
Long, Float or
Double. |
boolean |
hasAnnotation(java.lang.String name)
Checks if a given annotation is in the list. |
boolean |
hasInterface(SgClass intf)
Checks if this class or any of it's super classes has a given interface. |
boolean |
isBaseType()
Determines if the class represents a basic type ( String
, Boolean, Byte,
Character, Short,
Integer , Long,
Float, Double,
BigDecimal or BigInteger). |
boolean |
isInterface()
Returns if this is an interface. |
boolean |
isPrimitive()
Determines if the class represents a primitive type ( VOID,
BOOLEAN, BYTE, CHAR, SHORT,
INT , LONG, FLOAT or DOUBLE). |
java.lang.String |
toString()
|
java.lang.String |
toString(boolean showAnnotations)
Creates the class source with or without annotations. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final SgClass VOID
public static final SgClass BOOLEAN
public static final SgClass BYTE
public static final SgClass CHAR
public static final SgClass SHORT
public static final SgClass INT
public static final SgClass LONG
public static final SgClass FLOAT
public static final SgClass DOUBLE
public static final SgClass OBJECT
| Constructor Detail |
|---|
public SgClass(java.lang.String packageName,
java.lang.String simpleName)
packageName - Name of the package - Cannot be null.simpleName - Name (without package) of the class - Cannot be null.
public SgClass(java.lang.String modifiers,
java.lang.String packageName,
java.lang.String simpleName,
boolean isinterface,
SgClass enclosingClass)
modifiers - Modifier names separated with space - Cannot be null.packageName - Name of the package - Cannot be null.simpleName - Name (without package) of the class - Cannot be null.isinterface - Is this an interface?enclosingClass - Enclosing class if this is an inner class - Null is allowed.
public SgClass(java.lang.String modifiers,
java.lang.String packageName,
java.lang.String simpleName,
SgClass superClass,
boolean isinterface,
SgClass enclosingClass)
modifiers - Modifier names separated with space - Cannot be null.packageName - Name of the package - Cannot be null.simpleName - Name (without package) of the class - Cannot be null.superClass - Super class or null.isinterface - Is this an interface?enclosingClass - Enclosing class if this is an inner class - Null is allowed| Method Detail |
|---|
public final java.util.List<SgAnnotation> getAnnotations()
public final void addAnnotation(SgAnnotation annotation)
annotation - Annotation to add - Cannot be null.public final void addAnnotations(java.util.List<SgAnnotation> annotations)
addAll(..).
annotations - Annotations to add - Cannot be null.public final boolean hasAnnotation(java.lang.String name)
name - Name of the annotation to find - Cannot be null.
public final SgClass getSuperClass()
public final java.lang.String getSimpleNameAsPackage()
public final java.util.List<SgConstructor> getConstructors()
public final void addConstructor(SgConstructor constructor)
constructor - Constructor to add - Cannot be null.public final boolean isInterface()
public final java.util.List<SgMethod> getMethods()
public final void addMethod(SgMethod method)
method - Method to add - Cannot be null.public final java.lang.String getName()
public final java.lang.String getSourceName()
public final java.lang.String getNameAsFilename()
public final java.lang.String getNameAsSrcFilename()
public final java.lang.String getNameAsBinFilename()
public final java.lang.String getPackageName()
public final java.lang.String getSimpleName()
public final java.util.List<SgClass> getInterfaces()
public final void addInterface(SgClass intf)
intf - Interface to add - Cannot be null.public final java.lang.String getInterfacesCommaSeparated()
public final java.util.List<SgField> getFields()
public final void addField(SgField field)
field - Field to add - Cannot be null.public final java.util.List<SgClass> getClasses()
public final void addClass(SgClass clasz)
clasz - Inner class to add - Cannot be null.public final SgClass getEnclosingClass()
public final SgClass findClassByName(java.lang.String name)
name - Full qualified name of the class to find - Cannot be null.
public final SgMethod findMethodByName(java.lang.String name)
name - Name of the method to find - Cannot be null.
public final SgField findFieldByName(java.lang.String name)
name - Name of the field to find - Cannot be null.
public final java.lang.String getModifiers()
public final boolean isPrimitive()
VOID,
BOOLEAN, BYTE, CHAR, SHORT,
INT , LONG, FLOAT or DOUBLE).
public final boolean isBaseType()
String
, Boolean, Byte,
Character, Short,
Integer , Long,
Float, Double,
BigDecimal or BigInteger).
public final boolean hasInterface(SgClass intf)
intf - Interface to find - Cannot be null.
true else
false.public final java.lang.String toString()
toString in class java.lang.Objectpublic final java.lang.String toString(boolean showAnnotations)
showAnnotations - To include annotations true else
true.
public static SgClass create(SgClassPool pool,
java.lang.String className)
Class.forName(..) and analyzing it. Throws an
IllegalArgumentException if the class cannot be constructed
with "forName".
pool - Pool to use.className - Full qualified name.
public static SgClass create(SgClassPool pool,
java.lang.Class clasz)
pool - Pool to use.clasz - Class to analyze.
public static final SgClass getNonPrimitiveClass(SgClassPool pool,
SgClass primitive)
pool - Pool to use.primitive - Primitive class to convert. A call to isPrimitive()
on this argument must return true and a call to
equals(SgClass.VOID) returns false else an
IllegalArgumentException will be thrown.
public static final java.lang.String getToPrimitiveMethod(SgClass clasz)
Boolean,
Byte, Character,
Short, Integer,
Long, Float or
Double. If this class is not one of the above types a
IllegalArgumentException will be thrown.
clasz - Class to return a conversion method from.
Integer into an int
).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||