|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fudgemsg.mapping.FudgeSerializationContext
public class FudgeSerializationContext
The central point for Fudge message to Java Object serialisation on a given stream. Note that the deserialiser cannot process cyclic object graphs at the moment because of the way the builder interfaces are structured (i.e. we don't have access to an outer object until it's builder returned) so this will not send any.
Constructor Summary | |
---|---|
FudgeSerializationContext(FudgeContext fudgeContext)
Creates a new FudgeSerializationContext for the given FudgeContext . |
Method Summary | |
---|---|
static MutableFudgeFieldContainer |
addClassHeader(MutableFudgeFieldContainer message,
Class<?> clazz)
Adds class names to a message with ordinal 0 for use by a deserializer. |
static MutableFudgeFieldContainer |
addClassHeader(MutableFudgeFieldContainer message,
Class<?> clazz,
Class<?> receiverTarget)
Adds partial class names to a message with ordinal 0 for use by a deserializer. |
FudgeContext |
getFudgeContext()
Returns the associated FudgeContext . |
MutableFudgeFieldContainer |
newMessage()
Creates an initially empty message. |
MutableFudgeFieldContainer |
newMessage(FudgeFieldContainer fromMessage)
Creates a new message initially populated with the supplied message. |
void |
objectToFudgeMsg(MutableFudgeFieldContainer message,
String name,
Integer ordinal,
Object object)
Add a Java object to a Fudge message ( MutableFudgeFieldContainer instance) either natively if the associated FudgeTypeDictionary
recognises it, or as a sub-message using the serialization framework. |
MutableFudgeFieldContainer |
objectToFudgeMsg(Object object)
Converts a Java object to a Fudge message MutableFudgeFieldContainer instance using a FudgeMessageBuilder registered against the object's class
in the current FudgeObjectDictionary . |
void |
objectToFudgeMsgWithClassHeaders(MutableFudgeFieldContainer message,
String name,
Integer ordinal,
Object object)
Add a Java object to a Fudge message ( MutableFudgeFieldContainer instance) either natively if the associated FudgeTypeDictionary
recognises it, or as a sub-message using the serialization framework. |
void |
objectToFudgeMsgWithClassHeaders(MutableFudgeFieldContainer message,
String name,
Integer ordinal,
Object object,
Class<?> receiverTarget)
Add a Java object to a Fudge message ( MutableFudgeFieldContainer instance) either natively if the associated FudgeTypeDictionary
recognises it, or as a sub-message using the serialization framework. |
void |
reset()
Resets the buffers used for object graph logics. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FudgeSerializationContext(FudgeContext fudgeContext)
FudgeSerializationContext
for the given FudgeContext
.
fudgeContext
- the FudgeContext
to useMethod Detail |
---|
public void reset()
reset()
on this context
should match a call to FudgeDeserializationContext.reset()
on the context used by the deserialiser
to keep the states of both sender and receiver consistent.
public MutableFudgeFieldContainer newMessage()
newMessage
in interface FudgeMessageFactory
public MutableFudgeFieldContainer newMessage(FudgeFieldContainer fromMessage)
newMessage
in interface FudgeMessageFactory
fromMessage
- the source message to copy fields from, not null
public FudgeContext getFudgeContext()
FudgeContext
.
FudgeContext
public void objectToFudgeMsg(MutableFudgeFieldContainer message, String name, Integer ordinal, Object object)
MutableFudgeFieldContainer
instance) either natively if the associated FudgeTypeDictionary
recognises it, or as a sub-message using the serialization framework.
message
- the message to add this object toname
- field name to add with, or null
for noneordinal
- ordinal index to add with, or null
for noneobject
- value to addpublic void objectToFudgeMsgWithClassHeaders(MutableFudgeFieldContainer message, String name, Integer ordinal, Object object)
MutableFudgeFieldContainer
instance) either natively if the associated FudgeTypeDictionary
recognises it, or as a sub-message using the serialization framework. If encoded as a sub-message, class header fields are added. This can make
deserialization easier but increases the message length.
message
- the message to add this object toname
- field name to add with, or null
for noneordinal
- ordinal index to add with, or null
for noneobject
- value to addpublic void objectToFudgeMsgWithClassHeaders(MutableFudgeFieldContainer message, String name, Integer ordinal, Object object, Class<?> receiverTarget)
MutableFudgeFieldContainer
instance) either natively if the associated FudgeTypeDictionary
recognises it, or as a sub-message using the serialization framework. If encoded as a sub-message, class header fields are added. This can make
deserialization easier but increases the message length. It is assumed that the deserializer will already know the target class by other means, so
the message payload may end up being smaller than with objectToFudgeMsgWithClassHeaders(MutableFudgeFieldContainer,String,Integer,Object)
.
message
- the message to add this object toname
- field name to add with, or null
for noneordinal
- ordinal index to add with, or null
for noneobject
- value to addreceiverTarget
- the Java class the receiver will expectpublic MutableFudgeFieldContainer objectToFudgeMsg(Object object)
MutableFudgeFieldContainer
instance using a FudgeMessageBuilder
registered against the object's class
in the current FudgeObjectDictionary
. Note that a mutable container is returned (from the definition of FudgeMessageBuilder
so that the caller is
able to append additional data to the message if required, e.g. addClassHeader(MutableFudgeFieldContainer,Class)
.
object
- the Java object to serialize
public static MutableFudgeFieldContainer addClassHeader(MutableFudgeFieldContainer message, Class<?> clazz)
message
- the message to add the fields toclazz
- the Java class to add type data for
public static MutableFudgeFieldContainer addClassHeader(MutableFudgeFieldContainer message, Class<?> clazz, Class<?> receiverTarget)
addClassHeader(MutableFudgeFieldContainer,Class)
.
message
- the message to add the fields toclazz
- the Java class to add type data forreceiverTarget
- the Java class the receiver will expect
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |