Package org.kie.api.marshalling
Interface ObjectMarshallingStrategy
-
public interface ObjectMarshallingStrategy
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ObjectMarshallingStrategy.Context
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
accept(Object object)
ObjectMarshallingStrategy.Context
createContext()
Creates a new marshalling contextdefault String
getName()
Override this method if you want multiple marshalling strategies of the same implementation in environmentbyte[]
marshal(ObjectMarshallingStrategy.Context context, ObjectOutputStream os, Object object)
This method is analogous to the write() method, but instead of writing the object into an output stream, it returns the marshalled object as a byte[].Object
read(ObjectInputStream os)
Object
unmarshal(ObjectMarshallingStrategy.Context context, ObjectInputStream is, byte[] object, ClassLoader classloader)
This method is analogous to the read method, but instead of reading it from an input stream, it reads it from a byte[]void
write(ObjectOutputStream os, Object object)
-
-
-
Method Detail
-
getName
default String getName()
Override this method if you want multiple marshalling strategies of the same implementation in environment- Returns:
- the unique name in runtime environment of the ObjectMarshallingStrategy
-
accept
boolean accept(Object object)
-
write
void write(ObjectOutputStream os, Object object) throws IOException
- Throws:
IOException
-
read
Object read(ObjectInputStream os) throws IOException, ClassNotFoundException
- Throws:
IOException
ClassNotFoundException
-
marshal
byte[] marshal(ObjectMarshallingStrategy.Context context, ObjectOutputStream os, Object object) throws IOException
This method is analogous to the write() method, but instead of writing the object into an output stream, it returns the marshalled object as a byte[].- Parameters:
context
- the context for this strategy created by the method #createContext()object
- the object to be marshalled- Returns:
- the marshalled byte[] of the input object
- Throws:
IOException
-
unmarshal
Object unmarshal(ObjectMarshallingStrategy.Context context, ObjectInputStream is, byte[] object, ClassLoader classloader) throws IOException, ClassNotFoundException
This method is analogous to the read method, but instead of reading it from an input stream, it reads it from a byte[]- Parameters:
context
- the context for this strategy created by the method #createContext()object
- the marshalled object in a byte[]- Returns:
- the unmarshalled Object
- Throws:
IOException
ClassNotFoundException
-
createContext
ObjectMarshallingStrategy.Context createContext()
Creates a new marshalling context
-
-