org.objectweb.jorm.type.api
Interface PTypeSpace

All Superinterfaces:
java.io.Serializable

public interface PTypeSpace
extends java.io.Serializable

The PTypeSpace interface defines a space of JORM type along with the inheritance relationships that may exist between them.

Author:
P. D?chamboux

Field Summary
static PType BIGDECIMAL
           
static PType BIGINTEGER
           
static PType BOOLEAN
           
static PType BYTE
           
static PType BYTEARRAY
           
static PType CHAR
           
static PType CHARARRAY
           
static PType DATE
           
static PType DOUBLE
           
static PType FLOAT
           
static PType INT
           
static PType LONG
           
static java.lang.String[][] NULLSUPERCLASSNAMES
           
static PType[] NULLSUPERTYPES
           
static PType OBJBOOLEAN
           
static PType OBJBYTE
           
static PType OBJCHAR
           
static PType OBJDOUBLE
           
static PType OBJFLOAT
           
static PType OBJINT
           
static PType OBJLONG
           
static PType OBJSHORT
           
static PType[] PREDEFINEDPTYPES
           
static PType REFTOP
           
static PType[] SCALARPTYPES
           
static PType SERIALIZED
           
static PType SHORT
           
static PType STRING
           
 
Method Summary
 PType createPType(java.lang.String classname)
          It creates a new PType for a JORM class that has no inherited class.
 PType createPType(java.lang.String[] gcnames, PType ptype)
          It creates a new PType for a JORM generic class instance.
 PType createPType(java.lang.String[] gcnames, java.lang.String typename, java.lang.String[][] superclassnames)
          It creates a new PType for a JORM generic class instance.
 PType createPType(java.lang.String classname, java.lang.String[][] superclassnames)
          It creates a new PType for a JORM class.
 PType getPType(java.lang.String classname)
          It tries to retrieve a PType representing a JORM class with the given class name.
 PType[] getSubTypes(PType pt)
          Retrieves all subtypes of this PType defined within its PTypeSpace.
 boolean isa(PType pt1, PType pt2)
          It compares to PType representing JORM classes.
 

Field Detail

BOOLEAN

public static final PType BOOLEAN

CHAR

public static final PType CHAR

BYTE

public static final PType BYTE

SHORT

public static final PType SHORT

INT

public static final PType INT

LONG

public static final PType LONG

FLOAT

public static final PType FLOAT

DOUBLE

public static final PType DOUBLE

OBJBOOLEAN

public static final PType OBJBOOLEAN

OBJCHAR

public static final PType OBJCHAR

OBJBYTE

public static final PType OBJBYTE

OBJSHORT

public static final PType OBJSHORT

OBJINT

public static final PType OBJINT

OBJLONG

public static final PType OBJLONG

OBJFLOAT

public static final PType OBJFLOAT

OBJDOUBLE

public static final PType OBJDOUBLE

STRING

public static final PType STRING

DATE

public static final PType DATE

CHARARRAY

public static final PType CHARARRAY

BYTEARRAY

public static final PType BYTEARRAY

SERIALIZED

public static final PType SERIALIZED

BIGINTEGER

public static final PType BIGINTEGER

BIGDECIMAL

public static final PType BIGDECIMAL

REFTOP

public static final PType REFTOP

PREDEFINEDPTYPES

public static final PType[] PREDEFINEDPTYPES

SCALARPTYPES

public static final PType[] SCALARPTYPES

NULLSUPERTYPES

public static final PType[] NULLSUPERTYPES

NULLSUPERCLASSNAMES

public static final java.lang.String[][] NULLSUPERCLASSNAMES
Method Detail

createPType

public PType createPType(java.lang.String classname)
                  throws PExceptionTyping
It creates a new PType for a JORM class that has no inherited class.

Parameters:
classname - The name of the JORM class.
Returns:
The created PType or the existing one if it has the same definition (same name and same super types).
Throws:
PExceptionTyping - Raised when a PType with this class name exists with a different array of super types.

createPType

public PType createPType(java.lang.String classname,
                         java.lang.String[][] superclassnames)
                  throws PExceptionTyping
It creates a new PType for a JORM class. It is defined by its name and its inheritance hierarchy. For example, if "Engineer" inherits from "Employee" that inherits from "Person", then the following stands:
  • classname = "schm1.Engineer"
  • superclassnames = {{"schm1.Engineer", "schm2.Employee"}, {"schm2.Employee", "schm3.Person"}}
  • Parameters:
    classname - The name of the JORM class to be defined.
    superclassnames - The hierarchy of of classes inherited by the previous class (defined by classname) if any.
    Returns:
    The created PType or the existing one if it has the same definition (same name and same super types).
    Throws:
    PExceptionTyping - Raised when a PType with this class name exists with a different array of super types.

    createPType

    public PType createPType(java.lang.String[] gcnames,
                             PType ptype)
                      throws PExceptionTyping
    It creates a new PType for a JORM generic class instance. Such an instance may have a nested structure like "list>>", which means that:
  • gcnames = {"list", "array", "set"}
  • ptypename = INT
  • Parameters:
    gcnames - The array of names of the nested generic classes.
    ptype - The PType of the type of the elements contained within this generic class, which is one of those defined inside PREDEFINEDPTYPES.
    Returns:
    The created PType or the existing one if it has the same definition (same name and same element type).
    Throws:
    PExceptionTyping - Raised when a PType with this class name exists with a different inner PType

    createPType

    public PType createPType(java.lang.String[] gcnames,
                             java.lang.String typename,
                             java.lang.String[][] superclassnames)
                      throws PExceptionTyping
    It creates a new PType for a JORM generic class instance. Such an instance may have a nested structure like "list>>", which means that:
  • gcnames = {"list", "array", "set"}
  • typename = "schm1.Engineer"
  • superclassnames = {{"schm1.Engineer", "schm2.Employee"}, {"schm2.Employee", "schm3.Person"}}
  • Parameters:
    gcnames - The array of names of the nested generic classes.
    typename - The name of the type of the elements contained within this generic class.
    superclassnames - The hierarchy of of classes inherited by the previous class (defined by typename) if any.
    Returns:
    The created PType or the existing one if it has the same definition (same name and same element type).
    Throws:
    PExceptionTyping - Raised when a PType with this class name exists with a different inner PType

    getPType

    public PType getPType(java.lang.String classname)
    It tries to retrieve a PType representing a JORM class with the given class name.

    Parameters:
    classname - The name of a JORM class the PType is looking for.
    Returns:
    The relevant PType if one has been found or null if none found.

    getSubTypes

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

    Parameters:
    pt - The concerned PType.
    Returns:
    The array of PType containing all these subtypes.

    isa

    public boolean isa(PType pt1,
                       PType pt2)
    It compares to PType representing JORM classes. It verifies if the first one conforms to the second one.

    Parameters:
    pt1 - The first JORM class PType.
    pt2 - The second JORM class PType.
    Returns:
    It returns true if pt1 conforms to pt2.