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

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. | |
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.
|
|
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. |
|
|
Returns the field's value.
Implemented in com::codemesh::peer::AbstractPeerType. |
|
|
Returns the field's value.
Implemented in com::codemesh::peer::AbstractPeerType. |
|
|
Returns the field's value.
Implemented in com::codemesh::peer::AbstractPeerType. |
|
|
Returns the field's value.
Implemented in com::codemesh::peer::AbstractPeerType. |
|
|
Returns the field's value.
Implemented in com::codemesh::peer::AbstractPeerType. |
|
|
Returns the field's value.
Implemented in com::codemesh::peer::AbstractPeerType. |
|
|
Returns the field's value.
Implemented in com::codemesh::peer::AbstractPeerType. |
|
|
Returns the field's value.
Implemented in com::codemesh::peer::AbstractPeerType. |
|
|
Returns the field's value.
Implemented in com::codemesh::peer::AbstractPeerType. |
1.4.1