org.objectweb.jorm.type.api

Class PType

Implemented Interfaces:
Serializable

public class PType
extends java.lang.Object
implements Serializable

The PType class defines the minimal information required to define a JORM type that belongs to a PTypeSpace. It should be derived for PType representing JORM classes. This derivation should be different between classes and generic classes.

Author:
P. D?chamboux

Field Summary

static int
NOSIZE
static short
TYPECODE_BIGDECIMAL
static short
TYPECODE_BIGINTEGER
static short
TYPECODE_BOOLEAN
static short
TYPECODE_BYTE
static short
TYPECODE_BYTEARRAY
static short
TYPECODE_CHAR
static short
TYPECODE_CHARARRAY
static short
TYPECODE_DATE
static short
TYPECODE_DOUBLE
static short
TYPECODE_FLOAT
static short
TYPECODE_INT
static short
TYPECODE_LONG
static short
TYPECODE_OBJBOOLEAN
static short
TYPECODE_OBJBYTE
static short
TYPECODE_OBJCHAR
static short
TYPECODE_OBJDOUBLE
static short
TYPECODE_OBJFLOAT
static short
TYPECODE_OBJINT
static short
TYPECODE_OBJLONG
static short
TYPECODE_OBJSHORT
static short
TYPECODE_REFERENCE
static short
TYPECODE_SERIALIZED
static short
TYPECODE_SHORT
static short
TYPECODE_STRING

Constructor Summary

PType(String classname, PTypeSpace typespace)
It constructs the types that represent JORM classes, be it generic or not.
PType(short typecode, String jormname, String javaname, String constname, String codingname)
It constructs the types that represent basic JORM types defined as constants within the PTypeSpace interface.

Method Summary

boolean
equals(Object o)
String
getCodingName()
It retrieves the coding name associated to this PType.
PType[]
getDirectSubTypes()
Computes the array of direct sub type
PType[]
getInheritedPType()
It retrieves the PType directly inherited by a PType representing a JORM class.
String
getJavaName()
It retrieves the Java name associated to this PType.
String
getJormName()
It retrieves the JORM name associated to this PType.
PType
getNestedPType()
It retrieves the nested PType in case of a generic class PType.
PTypeSpace
getPTypeSpace()
It retrieves the type space associated to this PType.
String
getProgName()
It retrieves the name of the associated constant for programming access.
PType[]
getSubTypes()
Retrieves all subtypes of this PType defined within its PTypeSpace.
int
getTypeCode()
It retrieves the code associated to this PType.
boolean
isDirectSubType(PType parent)
boolean
isa(PType pt)
It compares if the current PType conforms to the given PType.

Field Details

NOSIZE

public static final int NOSIZE

Field Value:
-1


TYPECODE_BIGDECIMAL

public static final short TYPECODE_BIGDECIMAL

Field Value:
22


TYPECODE_BIGINTEGER

public static final short TYPECODE_BIGINTEGER

Field Value:
21


TYPECODE_BOOLEAN

public static final short TYPECODE_BOOLEAN

Field Value:
0


TYPECODE_BYTE

public static final short TYPECODE_BYTE

Field Value:
2


TYPECODE_BYTEARRAY

public static final short TYPECODE_BYTEARRAY

Field Value:
19


TYPECODE_CHAR

public static final short TYPECODE_CHAR

Field Value:
1


TYPECODE_CHARARRAY

public static final short TYPECODE_CHARARRAY

Field Value:
18


TYPECODE_DATE

public static final short TYPECODE_DATE

Field Value:
17


TYPECODE_DOUBLE

public static final short TYPECODE_DOUBLE

Field Value:
7


TYPECODE_FLOAT

public static final short TYPECODE_FLOAT

Field Value:
6


TYPECODE_INT

public static final short TYPECODE_INT

Field Value:
4


TYPECODE_LONG

public static final short TYPECODE_LONG

Field Value:
5


TYPECODE_OBJBOOLEAN

public static final short TYPECODE_OBJBOOLEAN

Field Value:
8


TYPECODE_OBJBYTE

public static final short TYPECODE_OBJBYTE

Field Value:
10


TYPECODE_OBJCHAR

public static final short TYPECODE_OBJCHAR

Field Value:
9


TYPECODE_OBJDOUBLE

public static final short TYPECODE_OBJDOUBLE

Field Value:
15


TYPECODE_OBJFLOAT

public static final short TYPECODE_OBJFLOAT

Field Value:
14


TYPECODE_OBJINT

public static final short TYPECODE_OBJINT

Field Value:
12


TYPECODE_OBJLONG

public static final short TYPECODE_OBJLONG

Field Value:
13


TYPECODE_OBJSHORT

public static final short TYPECODE_OBJSHORT

Field Value:
11


TYPECODE_REFERENCE

public static final short TYPECODE_REFERENCE

Field Value:
23


TYPECODE_SERIALIZED

public static final short TYPECODE_SERIALIZED

Field Value:
20


TYPECODE_SHORT

public static final short TYPECODE_SHORT

Field Value:
3


TYPECODE_STRING

public static final short TYPECODE_STRING

Field Value:
16

Constructor Details

PType

protected PType(String classname,
                PTypeSpace typespace)
It constructs the types that represent JORM classes, be it generic or not.

Parameters:
classname - The name of the class for which a PType must be constructed.
typespace - The type space to which the constructed PType belongs.


PType

protected PType(short typecode,
                String jormname,
                String javaname,
                String constname,
                String codingname)
It constructs the types that represent basic JORM types defined as constants within the PTypeSpace interface.

Parameters:
typecode - The type code as defined within PType.
jormname - The JORM name of this basic type.
javaname - The Java associated with this basic type.
constname - The constant name for prog. access.

Method Details

equals

public boolean equals(Object o)


getCodingName

public String getCodingName()
It retrieves the coding name associated to this PType.

Returns:
It returns the coding name.


getDirectSubTypes

public PType[] getDirectSubTypes()
Computes the array of direct sub type

Returns:


getInheritedPType

public PType[] getInheritedPType()
It retrieves the PType directly inherited by a PType representing a JORM class.

Returns:
The array of directly inherited PType.


getJavaName

public String getJavaName()
It retrieves the Java name associated to this PType.

Returns:
It returns the Java name.


getJormName

public String getJormName()
It retrieves the JORM name associated to this PType.

Returns:
It returns the JORM name.


getNestedPType

public PType getNestedPType()
It retrieves the nested PType in case of a generic class PType.

Returns:
The nested PType.


getPTypeSpace

public PTypeSpace getPTypeSpace()
It retrieves the type space associated to this PType.

Returns:
The associated type space.


getProgName

public String getProgName()
It retrieves the name of the associated constant for programming access.

Returns:
It returns the Java name.


getSubTypes

public PType[] getSubTypes()
Retrieves all subtypes of this PType defined within its PTypeSpace.

Returns:
The array of PType containing all these subtypes.


getTypeCode

public int getTypeCode()
It retrieves the code associated to this PType.

Returns:
It returns the Java name.


isDirectSubType

public boolean isDirectSubType(PType parent)


isa

public boolean isa(PType pt)
It compares if the current PType conforms to the given PType. In case of PType representing JORM classes, the comparison is delegated to the associated PTypeSpace.

Parameters:
pt - The PType to be compared with.

Returns:
It returns true if this PType conforms to the one passed as parameter.