| javax.media.jai.remote.Serializer
All known Subclasses: com.sun.media.jai.rmi.SerializerImpl,
Serializer | public interface Serializer (Code) | | An interface to be implemented by classes which are capable of
converting an instance of a supported class into a state representation
of the object which is serializable. Supported classes may in fact be
classes or interfaces.
When possible, classes (not interfaces) should be supported explicitly,
i.e., the getObjectClass() method of the
SerializableState returned by getState(Object)
should return the same value which would be returned by invoking
getClass() on the object passed to
getState(Object) . In particular, whenever feasible a
Serializer should not be used to serialize a given object
into a form which when deserialized would yield an instance of the
superclass of the class of which the object is an instance. When it is
not possible to provide a class-specific Serializer , such
as when a factory class generate subclasses of itself via
factory methods, then permitsSubclasses() should return
true ; in the case of class-specific Serializer s
it should return false .
See Also: SerializableState See Also: java.io.Serializable since: JAI 1.1 |
getState | SerializableState getState(Object o, RenderingHints h)(Code) | | Converts an object into a state-preserving object which may be
serialized. If the value returned by getSupportedClass()
is a class, i.e., not an interface, then the parameter of
getState() should be an instance of that class; if
getSupportedClass() returns an interface, then the
parameter of getState() should implement that interface.
If the apposite condition is not satisfied then an
IllegalArgumentException will be thrown.
If the class of the parameter is supported explicitly, i.e., is an
instance of the class returned by getSupportedClass() , then
the object returned by the getObject() method of the
generated SerializableState will be an instance of the
same class. If getSupportedClass() returns an interface
which the class of the parameter implements, then the object returned
by the getObject() method of the generated
SerializableState will be an instance of an unspecified
class which implements that interface.
Parameters: o - The object to be converted into a serializable form. Parameters: h - Configuration parameters the exact nature of which isSerializer -dependent. If null ,reasonable default settings should be used. A serializable form of the supplied object. exception: IllegalArgumentException - if o isnull , the supported class is an interfacenot implemented by the class of which o isan instance, or the supported class is not an interfaceand getSupportedClass().equals(o.getClass()) returns false . |
getSupportedClass | Class getSupportedClass()(Code) | | Returns the class or interface which is supported by this
Serializer .
The supported Class . |
permitsSubclasses | boolean permitsSubclasses()(Code) | | Returns true if and only if it is legal for this
Serializer to be used to serialize a subclass. In
general this method should return false , i.e., a specific
Serializer should be registered explicitly for each class.
In some cases this is however not expedient. An example of this is a
Serializer of classes created by a factory class: the
exact subclasses may not be known but sufficient information may be
able to be extracted from the subclass instance to permit its
serialization by the Serializer registered for the factory
class.
|
|
|