All Packages Class Hierarchy This Package Previous Next Index
Interface com.roguewave.vsj.DefineCollectable
- public interface DefineCollectable
The DefineCollectable interface is used with the CollectableStreamer class
to map Java classes to C++ subclasses of class RWCollectable from Tools.h++.
This interface must be implemented by classes that
are to be registered with an instance of CollectableStreamer. To implement
this interface, you must know whether the C++ class uses a "ClassId"
or a "StringId", and what that Id is. These can be found by finding
the declaration of either the RWDEFINE_COLLECTABLE (uses ClassId) or
RWDEFINE_NAMED_COLLECTABLE (uses StringId) macros on the C++ side
for the class being mapped.
- See Also:
- CollectableStreamer
-
NO_CLASSID
- The value to be returned by getCxxClassId() for C++ classes
that use StringIds and not ClassIds.
-
NO_STRINGID
- The value to be returned by getCxxStringId() for C++ classes
that use ClassIds and not StringIds.
-
create(VirtualInputStream)
- This method will be called by CollectableStreamer to
create an instance of the object being
restored.
-
getComparator()
- Return a Comparator object for the Java class being mapped.
-
getCxxClassId()
- This method must return the C++ ClassId when the C++ class
being mapped uses a ClassId and not a StringId.
-
getCxxStringId()
- This method must return the C++ StringId when the C++ class
being mapped uses a StringId and not a ClassId.
-
getJavaClass()
- This method must return a java Class object for the Java class
being mapped.
-
restoreGuts(Object, VirtualInputStream, CollectableStreamer)
- This method will be called by CollectableStreamer to restore the guts,
or internal state, of the object being restored.
-
saveGuts(Object, VirtualOutputStream, CollectableStreamer)
- This method will be called by CollectableStreamer to save the guts,
or internal state, of the given object to the stream.
NO_CLASSID
public static final int NO_CLASSID
- The value to be returned by getCxxClassId() for C++ classes
that use StringIds and not ClassIds.
NO_STRINGID
public static final String NO_STRINGID
- The value to be returned by getCxxStringId() for C++ classes
that use ClassIds and not StringIds.
create
public abstract Object create(VirtualInputStream vstr) throws IOException
- This method will be called by CollectableStreamer to
create an instance of the object being
restored. Note that the guts (internal state) of the object
will be restored in the restoreGuts() method and should not
be restored here. You may, if you must, carefully read built-in
types from the supplied stream if they are necessary for the
creation of the object. You may not, however, do
anything which would result in a recursive call
to vstr.restoreObject(). This would cause the read table
to be out of sync and the results could be catastrophic.
restoreGuts
public abstract void restoreGuts(Object obj,
VirtualInputStream vstr,
CollectableStreamer polystr) throws IOException
- This method will be called by CollectableStreamer to restore the guts,
or internal state, of the object being restored. Here you may
make recursive calls to vstr.restoreObject() for which you
will probably want to use the supplied CollectableStreamer.
saveGuts
public abstract void saveGuts(Object obj,
VirtualOutputStream vstr,
CollectableStreamer polystr) throws IOException
- This method will be called by CollectableStreamer to save the guts,
or internal state, of the given object to the stream. Here you may
make recursive calls to vstr.saveObject() for which you
will probably want to use the supplied CollectableStreamer.
getCxxClassId
public abstract int getCxxClassId()
- This method must return the C++ ClassId when the C++ class
being mapped uses a ClassId and not a StringId. If the class
being mapped uses a StringId, this method should return
the value NO_CLASSID. This method is used by CollectableStreamer
during registration.
getComparator
public abstract Comparator getComparator()
- Return a Comparator object for the Java class being mapped.
For consistency when streaming objects between Java and C++, the
semantics of the Comparator returned here should match that of
the possibly-overridden RWCollectable::compareTo() method
from the C++ side.
getCxxStringId
public abstract String getCxxStringId()
- This method must return the C++ StringId when the C++ class
being mapped uses a StringId and not a ClassId. If the class
being mapped uses a ClassId, this method must return
the value NO_STRINGID. This method is used by CollectableStreamer
during registration.
getJavaClass
public abstract Class getJavaClass()
- This method must return a java Class object for the Java class
being mapped. It is used by CollectableStreamer during registration.
All Packages Class Hierarchy This Package Previous Next Index