org.objectweb.jorm.naming.api

Interface PNameCoder

Known Subinterfaces:
FilteredPNamingContext, KeyFilteredNamingContext, PBinder, PNameManager, PNamingContext

public interface PNameCoder

The PNameCoder defines the external structure of the name it manages, which corresponds to the type involved in the encoding/decoding process. Furthermore, several name format may be supported by a particular name coder.

Author:
R. Basset, P. D?chamboux

Field Summary

static int
CTBIGDECIMAL
The coding type of the naming context is a bytearray.
static int
CTBIGINTEGER
The coding type of the naming context is a bytearray.
static int
CTBYTE
The coding type of the naming context is a byte.
static int
CTBYTEARRAY
The coding type of the naming context is a bytearray.
static int
CTCHAR
The coding type of the naming context is an char.
static int
CTCHARARRAY
The coding type of the naming context is a chararray.
static int
CTCOMPOSITE
The coding type of the naming context is an Object that is composite name (e.g., a multi-fields relational primary key).
static int
CTDATE
The coding type of the naming context is a date.
static int
CTINT
The coding type of the naming context is an int.
static int
CTLONG
The coding type of the naming context is a long.
static int
CTOBYTE
The coding type of the naming context is a byte.
static int
CTOCHAR
The coding type of the naming context is an char.
static int
CTOINT
The coding type of the naming context is an int.
static int
CTOLONG
The coding type of the naming context is a long.
static int
CTOSHORT
The coding type of the naming context is a short.
static int
CTSHORT
The coding type of the naming context is a short.
static int
CTSTRING
The coding type of the naming context is a string.
static int
CTSYSTEM
The coding type of the naming context is an Object that is DS-specific.

Method Summary

boolean
codingSupported(int codingtype)
It tests if a given coding type is supported by this naming context.
PName
decode(byte[] en)
The decode methods recreates PName within a naming context from an encoded representation.
PName
decodeAbstract(Object en, Object context)
The decodeAbstract methods recreates PName within a naming context from an encoded representation.
PName
decodeBigDecimal(BigDecimal en)
The decodeBigDecimal methods recreates PName within a naming context from an encoded representation.
PName
decodeBigInteger(BigInteger en)
The decodeBigInteger methods recreates PName within a naming context from an encoded representation.
PName
decodeByte(byte en)
The decodeByte methods recreates PName within a naming context from an encoded representation.
PName
decodeChar(char en)
The decodeChar methods recreates PName within a naming context from an encoded representation.
PName
decodeCharArray(char[] en)
The decodeCharArray methods recreates PName within a naming context from an encoded representation.
PName
decodeDate(Date en)
The decodeDate methods recreates PName within a naming context from an encoded representation.
PName
decodeInt(int en)
The decodeInt methods recreates PName within a naming context from an encoded representation.
PName
decodeLong(long en)
The decodeLong methods recreates PName within a naming context from an encoded representation.
PName
decodeObyte(Byte en)
The decodeObyte methods recreates PName within a naming context from an encoded representation.
PName
decodeOchar(Character en)
The decodeOchar methods recreates PName within a naming context from an encoded representation.
PName
decodeOint(Integer en)
The decodeOint methods recreates PName within a naming context from an encoded representation.
PName
decodeOlong(Long en)
The decodeOlong methods recreates PName within a naming context from an encoded representation.
PName
decodeOshort(Short en)
The decodeOshort methods recreates PName within a naming context from an encoded representation.
PName
decodeShort(short en)
The decodeShort methods recreates PName within a naming context from an encoded representation.
PName
decodeString(String en)
The decodeString methods recreates PName within a naming context from an encoded representation.
byte[]
encode(PName pn)
The encode method produces an encoded representation of a PName within a naming context.
Object
encodeAbstract(PName pn)
The encodeAbstract method produces an encoded representation of a PName within a naming context.
BigDecimal
encodeBigDecimal(PName pn)
The encodeBigDecimal method produces an encoded representation of a PName within a naming context.
BigInteger
encodeBigInteger(PName pn)
The encodeBigInteger method produces an encoded representation of a PName within a naming context.
byte
encodeByte(PName pn)
The encodeByte method produces an encoded representation of a PName within a naming context.
char
encodeChar(PName pn)
The encodeChar method produces an encoded representation of a PName within a naming context.
char[]
encodeCharArray(PName pn)
The encodeCharArray method produces an encoded representation of a PName within a naming context.
Date
encodeDate(PName pn)
The encodeDate method produces an encoded representation of a PName within a naming context.
int
encodeInt(PName pn)
The encodeInt method produces an encoded representation of a PName within a naming context.
long
encodeLong(PName pn)
The encodeLong method produces an encoded representation of a PName within a naming context.
Byte
encodeObyte(PName pn)
The encodeObyte method produces an encoded representation of a PName within a naming context.
Character
encodeOchar(PName pn)
The encodeOchar method produces an encoded representation of a PName within a naming context.
Integer
encodeOint(PName pn)
The encodeOint method produces an encoded representation of a PName within a naming context.
Long
encodeOlong(PName pn)
The encodeOlong method produces an encoded representation of a PName within a naming context.
Short
encodeOshort(PName pn)
The encodeOshort method produces an encoded representation of a PName within a naming context.
short
encodeShort(PName pn)
The encodeShort method produces an encoded representation of a PName within a naming context.
String
encodeString(PName pn)
The encodeString method produces an encoded representation of a PName within a naming context.
PName
getNull()
It yields a "null" representation of a name within this naming context.
PType
getPType()
Retrieves the PType associated to the JORM class which is the type of the name managed by this naming context.
void
setNullPName(Object o)
It assignes a object which defines a null representation of a name within this naming context.
void
setPType(PType pt)
Assigns the PType associated to the JORM class which is the type of the name managed by this naming context.
boolean
supportCompositeField(String fn, PType ft)
In case of a naming context that supports composite names (i.e., names composed of several typed fields, whose type is limited to scalar ones), it tests if a particular field is defined by this composite name.
boolean
supportDynamicComposite()
Tests if this naming context supports comosite name through a dynamic approach, which means that encodingAbstract/decodingAbstract use getter objects that implement the PNameGetter interface.
boolean
supportStaticComposite()
Tests if this naming context supports comosite name through a static approach, which means that encodingAbstract/decodingAbstract use getter objects that implement specific NsFieldGetter interface generated for a particular field "Field" within a particular NameDef space "Ns".

Field Details

CTBIGDECIMAL

public static final int CTBIGDECIMAL
The coding type of the naming context is a bytearray.

Field Value:
32768


CTBIGINTEGER

public static final int CTBIGINTEGER
The coding type of the naming context is a bytearray.

Field Value:
16384


CTBYTE

public static final int CTBYTE
The coding type of the naming context is a byte.

Field Value:
1


CTBYTEARRAY

public static final int CTBYTEARRAY
The coding type of the naming context is a bytearray.

Field Value:
8192


CTCHAR

public static final int CTCHAR
The coding type of the naming context is an char.

Field Value:
2


CTCHARARRAY

public static final int CTCHARARRAY
The coding type of the naming context is a chararray.

Field Value:
4096


CTCOMPOSITE

public static final int CTCOMPOSITE
The coding type of the naming context is an Object that is composite name (e.g., a multi-fields relational primary key).

Field Value:
524288


CTDATE

public static final int CTDATE
The coding type of the naming context is a date.

Field Value:
2048


CTINT

public static final int CTINT
The coding type of the naming context is an int.

Field Value:
8


CTLONG

public static final int CTLONG
The coding type of the naming context is a long.

Field Value:
16


CTOBYTE

public static final int CTOBYTE
The coding type of the naming context is a byte.

Field Value:
32


CTOCHAR

public static final int CTOCHAR
The coding type of the naming context is an char.

Field Value:
64


CTOINT

public static final int CTOINT
The coding type of the naming context is an int.

Field Value:
256


CTOLONG

public static final int CTOLONG
The coding type of the naming context is a long.

Field Value:
512


CTOSHORT

public static final int CTOSHORT
The coding type of the naming context is a short.

Field Value:
128


CTSHORT

public static final int CTSHORT
The coding type of the naming context is a short.

Field Value:
4


CTSTRING

public static final int CTSTRING
The coding type of the naming context is a string.

Field Value:
1024


CTSYSTEM

public static final int CTSYSTEM
The coding type of the naming context is an Object that is DS-specific.

Field Value:
65536

Method Details

codingSupported

public boolean codingSupported(int codingtype)
It tests if a given coding type is supported by this naming context.

Parameters:
codingtype - One of the coding type defined by CTxxx constants defined within this interface.

Returns:
It returns true if the coding type is supported by this naming context.


decode

public PName decode(byte[] en)
            throws PExceptionNaming
The decode methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is an array of bytes. It must always be supported by a naming context.

Parameters:
en - The byte to be decoded.

Returns:
The resulting PName.


decodeAbstract

public PName decodeAbstract(Object en,
                            Object context)
            throws PExceptionNaming,
                   UnsupportedOperationException
The decodeAbstract methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is abstract, which means that this is a Java object of any complexity. One example of such object is a getter interface representing a relational primary key (also called composite names).

Parameters:
en - The Object to be decoded.
context - A context used to decode the related data.

Returns:
The resulting PName.


decodeBigDecimal

public PName decodeBigDecimal(BigDecimal en)
            throws PExceptionNaming
The decodeBigDecimal methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a BigDecimal.

Parameters:
en - The BigDecimal to be decoded.

Returns:
The resulting PName.


decodeBigInteger

public PName decodeBigInteger(BigInteger en)
            throws PExceptionNaming
The decodeBigInteger methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a BigInteger.

Parameters:
en - The BigInteger to be decoded.

Returns:
The resulting PName.


decodeByte

public PName decodeByte(byte en)
            throws PExceptionNaming,
                   UnsupportedOperationException
The decodeByte methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a byte.

Parameters:
en - The byte to be decoded.

Returns:
The resulting PName.


decodeChar

public PName decodeChar(char en)
            throws PExceptionNaming,
                   UnsupportedOperationException
The decodeChar methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a char.

Parameters:
en - The char to be decoded.

Returns:
The resulting PName.


decodeCharArray

public PName decodeCharArray(char[] en)
            throws PExceptionNaming
The decodeCharArray methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a String.

Parameters:
en - The char[] to be decoded.

Returns:
The resulting PName.


decodeDate

public PName decodeDate(Date en)
            throws PExceptionNaming
The decodeDate methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a Date.

Parameters:
en - The Date to be decoded.

Returns:
The resulting PName.


decodeInt

public PName decodeInt(int en)
            throws PExceptionNaming,
                   UnsupportedOperationException
The decodeInt methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is an int.

Parameters:
en - The int to be decoded.

Returns:
The resulting PName.


decodeLong

public PName decodeLong(long en)
            throws PExceptionNaming,
                   UnsupportedOperationException
The decodeLong methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a long.

Parameters:
en - The long to be decoded.

Returns:
The resulting PName.


decodeObyte

public PName decodeObyte(Byte en)
            throws PExceptionNaming,
                   UnsupportedOperationException
The decodeObyte methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a byte.

Parameters:
en - The Byte to be decoded.

Returns:
The resulting PName.


decodeOchar

public PName decodeOchar(Character en)
            throws PExceptionNaming,
                   UnsupportedOperationException
The decodeOchar methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a Character.

Parameters:
en - The Character to be decoded.

Returns:
The resulting PName.


decodeOint

public PName decodeOint(Integer en)
            throws PExceptionNaming,
                   UnsupportedOperationException
The decodeOint methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is an Integer.

Parameters:
en - The Integer to be decoded.

Returns:
The resulting PName.


decodeOlong

public PName decodeOlong(Long en)
            throws PExceptionNaming,
                   UnsupportedOperationException
The decodeOlong methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a Long.

Parameters:
en - The Long to be decoded.

Returns:
The resulting PName.


decodeOshort

public PName decodeOshort(Short en)
            throws PExceptionNaming,
                   UnsupportedOperationException
The decodeOshort methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a Short.

Parameters:
en - The Short to be decoded.

Returns:
The resulting PName.


decodeShort

public PName decodeShort(short en)
            throws PExceptionNaming,
                   UnsupportedOperationException
The decodeShort methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a short.

Parameters:
en - The short to be decoded.

Returns:
The resulting PName.


decodeString

public PName decodeString(String en)
            throws PExceptionNaming
The decodeString methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a String.

Parameters:
en - The String to be decoded.

Returns:
The resulting PName.


encode

public byte[] encode(PName pn)
            throws PExceptionNaming
The encode method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is an array of bytes. It must be always supported by a naming context.

Parameters:
pn - The PName to be encoded

Returns:
The array of bytes corresponding to the encoded representation.


encodeAbstract

public Object encodeAbstract(PName pn)
            throws PExceptionNaming,
                   UnsupportedOperationException
The encodeAbstract method produces an encoded representation of a PName within a naming context. The encoding format is the case of this method is a Java object of any complexity. Example of such object is a getter interface giving access of the fields of a relational primary key (also called composite names).

Parameters:
pn - The PName to be encoded.

Returns:
The Object corresponding to the encoded representation.


encodeBigDecimal

public BigDecimal encodeBigDecimal(PName pn)
            throws PExceptionNaming
The encodeBigDecimal method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a BigDecimal.

Parameters:
pn - The PName to be encoded

Returns:
The BigDecimal corresponding to the encoded representation.


encodeBigInteger

public BigInteger encodeBigInteger(PName pn)
            throws PExceptionNaming
The encodeBigInteger method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a BigInteger.

Parameters:
pn - The PName to be encoded

Returns:
The BigInteger corresponding to the encoded representation.


encodeByte

public byte encodeByte(PName pn)
            throws PExceptionNaming,
                   UnsupportedOperationException
The encodeByte method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a byte.

Parameters:
pn - The PName to be encoded

Returns:
The byte corresponding to the encoded representation.


encodeChar

public char encodeChar(PName pn)
            throws PExceptionNaming,
                   UnsupportedOperationException
The encodeChar method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a char.

Parameters:
pn - The PName to be encoded

Returns:
The char corresponding to the encoded representation.


encodeCharArray

public char[] encodeCharArray(PName pn)
            throws PExceptionNaming
The encodeCharArray method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a char[].

Parameters:
pn - The PName to be encoded

Returns:
The char[] corresponding to the encoded representation.


encodeDate

public Date encodeDate(PName pn)
            throws PExceptionNaming
The encodeDate method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a Date.

Parameters:
pn - The PName to be encoded

Returns:
The Date corresponding to the encoded representation.


encodeInt

public int encodeInt(PName pn)
            throws PExceptionNaming,
                   UnsupportedOperationException
The encodeInt method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a int.

Parameters:
pn - The PName to be encoded

Returns:
The int corresponding to the encoded representation.


encodeLong

public long encodeLong(PName pn)
            throws PExceptionNaming,
                   UnsupportedOperationException
The encodeLong method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a long.

Parameters:
pn - The PName to be encoded

Returns:
The long corresponding to the encoded representation.


encodeObyte

public Byte encodeObyte(PName pn)
            throws PExceptionNaming,
                   UnsupportedOperationException
The encodeObyte method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a Byte.

Parameters:
pn - The PName to be encoded

Returns:
The Byte corresponding to the encoded representation.


encodeOchar

public Character encodeOchar(PName pn)
            throws PExceptionNaming,
                   UnsupportedOperationException
The encodeOchar method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a Character.

Parameters:
pn - The PName to be encoded

Returns:
The Character corresponding to the encoded representation.


encodeOint

public Integer encodeOint(PName pn)
            throws PExceptionNaming,
                   UnsupportedOperationException
The encodeOint method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a Integer.

Parameters:
pn - The PName to be encoded

Returns:
The Integer corresponding to the encoded representation.


encodeOlong

public Long encodeOlong(PName pn)
            throws PExceptionNaming,
                   UnsupportedOperationException
The encodeOlong method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a Long.

Parameters:
pn - The PName to be encoded

Returns:
The Long corresponding to the encoded representation.


encodeOshort

public Short encodeOshort(PName pn)
            throws PExceptionNaming,
                   UnsupportedOperationException
The encodeOshort method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a Short.

Parameters:
pn - The PName to be encoded

Returns:
The Short corresponding to the encoded representation.


encodeShort

public short encodeShort(PName pn)
            throws PExceptionNaming,
                   UnsupportedOperationException
The encodeShort method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a short.

Parameters:
pn - The PName to be encoded

Returns:
The short corresponding to the encoded representation.


encodeString

public String encodeString(PName pn)
            throws PExceptionNaming
The encodeString method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a String.

Parameters:
pn - The PName to be encoded

Returns:
The String corresponding to the encoded representation.


getNull

public PName getNull()
It yields a "null" representation of a name within this naming context.

Returns:
The "null" PName associated with this naming context.


getPType

public PType getPType()
Retrieves the PType associated to the JORM class which is the type of the name managed by this naming context.

Returns:
The related PType.


setNullPName

public void setNullPName(Object o)
            throws PException
It assignes a object which defines a null representation of a name within this naming context.

Parameters:
o - can be a PNameGetter (generic or generated), a pname, or a simple value (ex: Integer).


setPType

public void setPType(PType pt)
Assigns the PType associated to the JORM class which is the type of the name managed by this naming context.

Parameters:
pt - The PType of the JORM class reference managed by this naming context.


supportCompositeField

public boolean supportCompositeField(String fn,
                                     PType ft)
In case of a naming context that supports composite names (i.e., names composed of several typed fields, whose type is limited to scalar ones), it tests if a particular field is defined by this composite name. It should be used by PClassMapping objects in order to verify, at deployment time, that naming contexts that are defined to manage the various references supports the same encoding name structure.

Returns:
true if the proposed field is supported by this composite name.


supportDynamicComposite

public boolean supportDynamicComposite()
Tests if this naming context supports comosite name through a dynamic approach, which means that encodingAbstract/decodingAbstract use getter objects that implement the PNameGetter interface.

Returns:
true if dynamic getter is supported by composite name coding.


supportStaticComposite

public boolean supportStaticComposite()
Tests if this naming context supports comosite name through a static approach, which means that encodingAbstract/decodingAbstract use getter objects that implement specific NsFieldGetter interface generated for a particular field "Field" within a particular NameDef space "Ns".

Returns:
true if static getter is supported by composite name coding.