Package de.ufinke.cubaja.cafebabe
Class Type
- java.lang.Object
-
- de.ufinke.cubaja.cafebabe.Type
-
public class Type extends Object
Wrapper for class and primitive type information.- Author:
- Uwe Finke
-
-
Field Summary
Fields Modifier and Type Field Description static TypeBOOLEANType representingboolean.static TypeBYTEType representingbyte.static TypeCHARType representingchar.static TypeCLASSType representingClass.static TypeDOUBLEType representingdouble.static TypeFLOATType representingfloat.static TypeINTType representingint.static TypeLONGType representinglong.static TypeOBJECTType representingObject.static TypeSHORTType representingshort.static TypeSTRINGType representingString.static TypeVOIDType representingvoid.
-
Constructor Summary
Constructors Constructor Description Type(GenClass type)Defines a type for a generated class.Type(GenClass type, String parameterName)Defines a type for a generated class and gives it a name.Type(Class<?> type)Defines a type by its class.Type(Class<?> type, String parameterName)Defines a type by class and gives it a name.Type(String type)Defines a type by name.Type(String type, String parameterName)Defines a type by name and gives it a name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)Tests equality to anotherTypeinstance.intgetSize()Returns the type's memory size in words.inthashCode()Returns the hash code.StringtoString()Returns aStringrepresentation.
-
-
-
Field Detail
-
VOID
public static final Type VOID
Type representingvoid.
-
BOOLEAN
public static final Type BOOLEAN
Type representingboolean.
-
BYTE
public static final Type BYTE
Type representingbyte.
-
SHORT
public static final Type SHORT
Type representingshort.
-
INT
public static final Type INT
Type representingint.
-
LONG
public static final Type LONG
Type representinglong.
-
FLOAT
public static final Type FLOAT
Type representingfloat.
-
DOUBLE
public static final Type DOUBLE
Type representingdouble.
-
CHAR
public static final Type CHAR
Type representingchar.
-
STRING
public static final Type STRING
Type representingString.
-
OBJECT
public static final Type OBJECT
Type representingObject.
-
CLASS
public static final Type CLASS
Type representingClass.
-
-
Constructor Detail
-
Type
public Type(String type)
Defines a type by name.- Parameters:
type- name of type
-
Type
public Type(String type, String parameterName)
Defines a type by name and gives it a name. This constructor may be used to name arguments which are passed to a method.- Parameters:
type- name of typeparameterName- name of argument
-
Type
public Type(Class<?> type)
Defines a type by its class.- Parameters:
type- class of type
-
Type
public Type(Class<?> type, String parameterName)
Defines a type by class and gives it a name. This constructor may be used to name arguments which are passed to a method.- Parameters:
type- class of typeparameterName- name of argument
-
Type
public Type(GenClass type)
Defines a type for a generated class.- Parameters:
type- generated class of type
-
-
Method Detail
-
equals
public boolean equals(Object o)
Tests equality to anotherTypeinstance. A type instance equals to another if both have the same descriptor.
-
toString
public String toString()
Returns aStringrepresentation.
-
getSize
public int getSize()
Returns the type's memory size in words.longanddoublehave size2,voidhas size0and all other types have size1.- Returns:
- size
-
-