|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.jac.core.SerializedJacObject
This class defines all the needed information when (de)serializing a JAC object.
It is used to (de)serialize a JacObject by
JacObjectInputStream
and
JacObjectOutputStream
. To ensure the correct use of
these streams, use only JacObject.(de)serialize()
.
Any aspect component can use a SerializedJacObject
to add any relevant information during the serialization process
(whenSerialized()
) or to extract any relevant
information during the deserialization process
(whenDeserialized()
).
JacObjectOutputStream
,
AspectComponent.whenSerialized(Wrappee,SerializedJacObject)
,
JacObjectInputStream
,
AspectComponent.whenDeserialized(SerializedJacObject,Wrappee)
,
Serialized FormField Summary | |
protected HashMap |
acInfos
Extra Aspect Component related infos to be serialized. |
protected HashMap |
fields
The serialized fields for this JAC object. |
protected boolean |
forwarder
If true, the deserialized object will be a forwarder towards the actual object. |
protected String |
jacObjectClassName
The class name of the serialized JAC object. |
static String |
STATELESS
|
Constructor Summary | |
SerializedJacObject(String jacObjectClassName)
The constructor of a serialized JacObject. |
Method Summary | |
void |
addField(String name,
Object value)
Add a field to be serialized. |
static Object |
deserialize(byte[] data)
Deserialize an object from an array of bytes. |
static Object |
deserializeArgs(byte[] data)
Deserialize the arguments of a method. |
void |
disableForwarding()
Disable the forwarding. |
void |
enableForwarding()
Enable the forwarding. |
Object |
getACInfos(String acName)
Get some aspect component related infos to be deserialized. |
Object |
getField(String name)
Get a serialized field value. |
HashMap |
getFields()
Returns a hashtable that contains the field names to be serialized and their values. |
String |
getJacObjectClassName()
Returns the serialized JAC object class name. |
boolean |
isForwarder()
Tells if the serialized object is a forwarder. |
static byte[] |
serialize(Object src)
Serialize an object into an array of bytes. |
static byte[] |
serializeArgs(Object[] args,
Boolean[] refs)
Serialize the arguments of a method. |
void |
setACInfos(String acName,
Object infos)
Add some aspect component related infos to be serialized. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String STATELESS
protected String jacObjectClassName
protected HashMap fields
protected HashMap acInfos
protected boolean forwarder
Constructor Detail |
public SerializedJacObject(String jacObjectClassName)
The programmer do not need to call this method since it is
implicitly called by JacObjectOutputStream
.
jacObjectClassName
- the class name of the serialized JAC objectJacObjectOutputStream
Method Detail |
public static byte[] serialize(Object src)
If the programmer uses this method, the aspect components are
upcalled (whenSerialized()
) to parametrize the
serialization by filling a SerializedJacObject
instance.
A symetric process is implemented by deserialize()
src
- the object to serialize
AspectComponent.whenSerialized(Wrappee,SerializedJacObject)
,
SerializedJacObject
,
deserialize(byte[])
,
JacObjectOutputStream
public static byte[] serializeArgs(Object[] args, Boolean[] refs)
public static Object deserialize(byte[] data)
If the programmer uses this method, the aspect components are
upcalled (whenDeserialized()
method) to parametrize the
deserialization by using a corresponding SerializedJacObject
instance.
A symetric process is implemented by serialize()
data
- the array of bytes
AspectComponent.whenDeserialized(SerializedJacObject,Wrappee)
,
SerializedJacObject
,
serialize(Object)
,
JacObjectInputStream
public static Object deserializeArgs(byte[] data)
public HashMap getFields()
public void addField(String name, Object value)
name
- the field namevalue
- its valuepublic Object getField(String name)
This value has been added with the addField
method.
name
- the name of the serialized field
addField(String,Object)
public String getJacObjectClassName()
public void setACInfos(String acName, Object infos)
This method can be used by an aspect component within the
whenSerialized()
method. It allows the aspect
programmer to add some relevant informations to be serialized
(for instance when transmiting JAC objects to remote host or
saving them on the disk).
During the deserialization, an aspect component can retrieve
these added information by using getACInfos()
.
acName
- the name of the aspect component that has set this
informationinfos
- any serializable objectAspectComponent
,
AspectComponent.whenSerialized(Wrappee,SerializedJacObject)
,
getACInfos(String)
public Object getACInfos(String acName)
This method can be used by an aspect component within the
whenDeserialized()
method. It allows the aspect
programmer to get some relevant informations to be deserialized
(for instance when transmiting JAC objects to remote host or
saving them on the disk).
The retrieved informations are usually set during the
serialization by using setACInfos()
.
acName
- the name of the aspect component that has set this
information
AspectComponent
,
AspectComponent.whenDeserialized(SerializedJacObject,Wrappee)
,
setACInfos(String,Object)
public boolean isForwarder()
When a serialized JAC object is a forwarder, then if, when deserialized, no name-corresponding JAC object is found, then the deserialized object is wrapped by a binding wrapper so that the binding aspect is able to resolve the actual object later on. Of course, if a corresponding JAC object is found, then the deserialized JAC object is replaced by the actual object.
When a serialized JAC object is not a forwarder, then no replacement or binding mechanism occurs.
NamingAC.whenSerialized(Wrappee,SerializedJacObject)
,
BindingAC.whenDeserialized(SerializedJacObject,Wrappee)
public void disableForwarding()
If this method is called, the isForwarder
method will return false.
isForwarder()
,
enableForwarding()
public void enableForwarding()
If this method is called, the isForwarder
method will return true (default).
isForwarder()
,
disableForwarding()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |