Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

com::codemesh::peer::PeerType Interface Reference
[Java Peer Framework]

A Java interface that may be implemented by concrete Java peer types. More...

Inheritance diagram for com::codemesh::peer::PeerType:

Inheritance graph
[legend]
List of all members.

Public Member Functions

void set_typeInfo (String typeInfo)
 Sets the typeinfo that represents the native instance's type.
String get_typeInfo ()
 Returns the typeinfo that represents the native instance's type.
void set_binaryData (byte[] data)
 Sets the native instance's data into the peer instance in the form of an array of bytes.
byte[] get_binaryData ()
 Returns the native instance's data in the form of an array of bytes.
void set_boolean (String fieldName, boolean b)
 Copies a native value into the peer instance using a name for later lookup.
void set_byte (String fieldName, byte b)
 Copies a native value into the peer instance using a name for later lookup.
void set_char (String fieldName, char ch)
 Copies a native value into the peer instance using a name for later lookup.
void set_double (String fieldName, double d)
 Copies a native value into the peer instance using a name for later lookup.
void set_float (String fieldName, float f)
 Copies a native value into the peer instance using a name for later lookup.
void set_int (String fieldName, int i)
 Copies a native value into the peer instance using a name for later lookup.
void set_long (String fieldName, long l)
 Copies a native value into the peer instance using a name for later lookup.
void set_short (String fieldName, short s)
 Copies a native value into the peer instance using a name for later lookup.
void set_Object (String fieldName, Object o)
 Copies a native value into the peer instance using a name for later lookup.
boolean get_boolean (String fieldName) throws PeerException
 Returns the field's value.
byte get_byte (String fieldName) throws PeerException
 Returns the field's value.
char get_char (String fieldName) throws PeerException
 Returns the field's value.
double get_double (String fieldName) throws PeerException
 Returns the field's value.
float get_float (String fieldName) throws PeerException
 Returns the field's value.
int get_int (String fieldName) throws PeerException
 Returns the field's value.
long get_long (String fieldName) throws PeerException
 Returns the field's value.
short get_short (String fieldName) throws PeerException
 Returns the field's value.
Object get_Object (String fieldName) throws PeerException
 Returns the field's value.

Detailed Description

A Java interface that may be implemented by concrete Java peer types.

This interface declares the API that a Java peer type may implement. A peer type is a type that is used as a stand-in type for a C++ instance that cannot interoperate with the proxy framework as it should. This is never necessary for types that start out as Java types. If you have an existing Java type you can generate fully functional C++ proxy types for it. The peer mechanism is most useful for types that start out as C++ types that the developer wishes to use with the proxy framework. Use cases could include:

As you can see, most of these use cases involve serialization. We believe that object serialization is the most important use case for this feature.

The most straightforward use case involves a developer wishing to serialize C++ instance data to the Java side using the standard Java serialization mechanism. For this to work, the C++ state needs to be copied into a Java object that can act as the C++ object's peer for these kinds of operations. The Java peer type needs to implement the interface Serializable or Externalizable for it to be usable with the Java serialization framework.

This requirements demonstrates the main motivation for creating additional custom peer types: the need for a peer type to implement a Java interface or extend a Java class in order to be useful. The former case is most easily handled by extending the com.codemesh.xmog.AbstractPeerType class and mixing in the custom interface. The latter case requires the developer to extend the requried class and to implement the PeerType interface, maybe by delegating to an embedded AbstractPeerType instance.

Other examples of peer types might be JavaSpaces Entrys. You can create a GenericEntry peer type which you can use to store native data in a JavaSpace.

The runtime library supplies an xmog_peer utility type that can be used to access the functionality of the com.codemesh.peer.PeerType interface from C++ without having to generate a proxy class for it. This can significantly ease your integration burden and provides a blueprint of the functionality that you have to support if you write your own custom peer type.

The most notable implementor of this interface is the com.codemesh.peer.AbstractPeerType class which can be your baseclass for a custom peer type.


Member Function Documentation

byte [] com::codemesh::peer::PeerType::get_binaryData  ) 
 

Returns the native instance's data in the form of an array of bytes.

It is the native type's responsibility to parse the byte array.

Implemented in com::codemesh::peer::AbstractPeerType.

boolean com::codemesh::peer::PeerType::get_boolean String  fieldName  )  throws PeerException
 

Returns the field's value.

Exceptions:
PeerException if the field cannot be found or if it is not of the correct type.

Implemented in com::codemesh::peer::AbstractPeerType.

byte com::codemesh::peer::PeerType::get_byte String  fieldName  )  throws PeerException
 

Returns the field's value.

Exceptions:
PeerException if the field cannot be found or if it is not of the correct type.

Implemented in com::codemesh::peer::AbstractPeerType.

char com::codemesh::peer::PeerType::get_char String  fieldName  )  throws PeerException
 

Returns the field's value.

Exceptions:
PeerException if the field cannot be found or if it is not of the correct type.

Implemented in com::codemesh::peer::AbstractPeerType.

double com::codemesh::peer::PeerType::get_double String  fieldName  )  throws PeerException
 

Returns the field's value.

Exceptions:
PeerException if the field cannot be found or if it is not of the correct type.

Implemented in com::codemesh::peer::AbstractPeerType.

float com::codemesh::peer::PeerType::get_float String  fieldName  )  throws PeerException
 

Returns the field's value.

Exceptions:
PeerException if the field cannot be found or if it is not of the correct type.

Implemented in com::codemesh::peer::AbstractPeerType.

int com::codemesh::peer::PeerType::get_int String  fieldName  )  throws PeerException
 

Returns the field's value.

Exceptions:
PeerException if the field cannot be found or if it is not of the correct type.

Implemented in com::codemesh::peer::AbstractPeerType.

long com::codemesh::peer::PeerType::get_long String  fieldName  )  throws PeerException
 

Returns the field's value.

Exceptions:
PeerException if the field cannot be found or if it is not of the correct type.

Implemented in com::codemesh::peer::AbstractPeerType.

Object com::codemesh::peer::PeerType::get_Object String  fieldName  )  throws PeerException
 

Returns the field's value.

Exceptions:
PeerException if the field cannot be found or if it is not of the correct type.

Implemented in com::codemesh::peer::AbstractPeerType.

short com::codemesh::peer::PeerType::get_short String  fieldName  )  throws PeerException
 

Returns the field's value.

Exceptions:
PeerException if the field cannot be found or if it is not of the correct type.

Implemented in com::codemesh::peer::AbstractPeerType.


The documentation for this interface was generated from the following file:
Generated on Wed May 31 14:01:37 2006 for Shared Codemesh Runtime Library API Reference by  doxygen 1.4.1