org.objectweb.jorm.naming.api
Interface PNameCoder

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

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(java.lang.Object en, java.lang.Object context)
          The decodeAbstract methods recreates PName within a naming context from an encoded representation.
 PName decodeBigDecimal(java.math.BigDecimal en)
          The decodeBigDecimal methods recreates PName within a naming context from an encoded representation.
 PName decodeBigInteger(java.math.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(java.util.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(java.lang.Byte en)
          The decodeObyte methods recreates PName within a naming context from an encoded representation.
 PName decodeOchar(java.lang.Character en)
          The decodeOchar methods recreates PName within a naming context from an encoded representation.
 PName decodeOint(java.lang.Integer en)
          The decodeOint methods recreates PName within a naming context from an encoded representation.
 PName decodeOlong(java.lang.Long en)
          The decodeOlong methods recreates PName within a naming context from an encoded representation.
 PName decodeOshort(java.lang.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(java.lang.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.
 java.lang.Object encodeAbstract(PName pn)
          The encodeAbstract method produces an encoded representation of a PName within a naming context.
 java.math.BigDecimal encodeBigDecimal(PName pn)
          The encodeBigDecimal method produces an encoded representation of a PName within a naming context.
 java.math.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.
 java.util.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.
 java.lang.Byte encodeObyte(PName pn)
          The encodeObyte method produces an encoded representation of a PName within a naming context.
 java.lang.Character encodeOchar(PName pn)
          The encodeOchar method produces an encoded representation of a PName within a naming context.
 java.lang.Integer encodeOint(PName pn)
          The encodeOint method produces an encoded representation of a PName within a naming context.
 java.lang.Long encodeOlong(PName pn)
          The encodeOlong method produces an encoded representation of a PName within a naming context.
 java.lang.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.
 java.lang.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(java.lang.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(java.lang.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 Detail

CTBYTE

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

See Also:
Constant Field Values

CTCHAR

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

See Also:
Constant Field Values

CTSHORT

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

See Also:
Constant Field Values

CTINT

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

See Also:
Constant Field Values

CTLONG

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

See Also:
Constant Field Values

CTOBYTE

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

See Also:
Constant Field Values

CTOCHAR

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

See Also:
Constant Field Values

CTOSHORT

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

See Also:
Constant Field Values

CTOINT

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

See Also:
Constant Field Values

CTOLONG

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

See Also:
Constant Field Values

CTSTRING

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

See Also:
Constant Field Values

CTDATE

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

See Also:
Constant Field Values

CTCHARARRAY

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

See Also:
Constant Field Values

CTBYTEARRAY

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

See Also:
Constant Field Values

CTBIGINTEGER

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

See Also:
Constant Field Values

CTBIGDECIMAL

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

See Also:
Constant Field Values

CTSYSTEM

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

See Also:
Constant Field Values

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).

See Also:
Constant Field Values
Method Detail

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.
Throws:
PExceptionNaming

decodeAbstract

public PName decodeAbstract(java.lang.Object en,
                            java.lang.Object context)
                     throws PExceptionNaming,
                            java.lang.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:
context - A context used to decode the related data.
en - The Object to be decoded.
Returns:
The resulting PName.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeByte

public PName decodeByte(byte en)
                 throws PExceptionNaming,
                        java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeObyte

public PName decodeObyte(java.lang.Byte en)
                  throws PExceptionNaming,
                         java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeChar

public PName decodeChar(char en)
                 throws PExceptionNaming,
                        java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeOchar

public PName decodeOchar(java.lang.Character en)
                  throws PExceptionNaming,
                         java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeInt

public PName decodeInt(int en)
                throws PExceptionNaming,
                       java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeOint

public PName decodeOint(java.lang.Integer en)
                 throws PExceptionNaming,
                        java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeLong

public PName decodeLong(long en)
                 throws PExceptionNaming,
                        java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeOlong

public PName decodeOlong(java.lang.Long en)
                  throws PExceptionNaming,
                         java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeShort

public PName decodeShort(short en)
                  throws PExceptionNaming,
                         java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeOshort

public PName decodeOshort(java.lang.Short en)
                   throws PExceptionNaming,
                          java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeString

public PName decodeString(java.lang.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.
Throws:
PExceptionNaming

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.
Throws:
PExceptionNaming

decodeDate

public PName decodeDate(java.util.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.
Throws:
PExceptionNaming

decodeBigInteger

public PName decodeBigInteger(java.math.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.
Throws:
PExceptionNaming

decodeBigDecimal

public PName decodeBigDecimal(java.math.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.
Throws:
PExceptionNaming

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.
Throws:
PExceptionNaming

encodeAbstract

public java.lang.Object encodeAbstract(PName pn)
                                throws PExceptionNaming,
                                       java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeByte

public byte encodeByte(PName pn)
                throws PExceptionNaming,
                       java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeObyte

public java.lang.Byte encodeObyte(PName pn)
                           throws PExceptionNaming,
                                  java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeChar

public char encodeChar(PName pn)
                throws PExceptionNaming,
                       java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeOchar

public java.lang.Character encodeOchar(PName pn)
                                throws PExceptionNaming,
                                       java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeInt

public int encodeInt(PName pn)
              throws PExceptionNaming,
                     java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeOint

public java.lang.Integer encodeOint(PName pn)
                             throws PExceptionNaming,
                                    java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeLong

public long encodeLong(PName pn)
                throws PExceptionNaming,
                       java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeOlong

public java.lang.Long encodeOlong(PName pn)
                           throws PExceptionNaming,
                                  java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeShort

public short encodeShort(PName pn)
                  throws PExceptionNaming,
                         java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeOshort

public java.lang.Short encodeOshort(PName pn)
                             throws PExceptionNaming,
                                    java.lang.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.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeString

public java.lang.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.
Throws:
PExceptionNaming

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.
Throws:
PExceptionNaming

encodeDate

public java.util.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.
Throws:
PExceptionNaming

encodeBigInteger

public java.math.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.
Throws:
PExceptionNaming

encodeBigDecimal

public java.math.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.
Throws:
PExceptionNaming

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.

setNullPName

public void setNullPName(java.lang.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).
Throws:
PException

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.

supportCompositeField

public boolean supportCompositeField(java.lang.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.

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.

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.

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.