|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.io.FieldMarshaller
public abstract class FieldMarshaller
Used to read and write a single field of a Streamable instance.
| Nested Class Summary | |
|---|---|
protected static class |
FieldMarshaller.MethodFieldMarshaller
Uses custom accessor methods to read and write a field. |
protected static class |
FieldMarshaller.StreamerMarshaller
Used to marshall and unmarshall classes for which we have a basic Streamer. |
| Field Summary | |
|---|---|
protected static FieldMarshaller |
_internMarshaller
The field marshaller for pooled strings. |
protected static Map<Class<?>,FieldMarshaller> |
_marshallers
Contains a mapping from field type to field marshaller instance for that type. |
protected String |
_type
|
protected static Class<?>[] |
READER_ARGS
Defines the signature to a custom field reader method. |
protected static Class<?>[] |
WRITER_ARGS
Defines the signature to a custom field writer method. |
| Constructor Summary | |
|---|---|
FieldMarshaller()
|
|
FieldMarshaller(String type)
|
|
| Method Summary | |
|---|---|
protected static Map<Class<?>,FieldMarshaller> |
createMarshallers()
Creates and returns a mapping for all known field marshaller types. |
static FieldMarshaller |
getFieldMarshaller(Field field)
Returns a field marshaller appropriate for the supplied field or null if no marshaller exists for the type contained by the field in question. |
static String |
getReaderMethodName(String field)
Returns the name of the custom reader method which will be used if it exists to stream a field with the supplied name. |
static String |
getWriterMethodName(String field)
Returns the name of the custom writer method which will be used if it exists to stream a field with the supplied name. |
abstract void |
readField(Field field,
Object target,
ObjectInputStream in)
Reads the contents of the supplied field from the supplied stream and sets it in the supplied object. |
String |
toString()
|
protected static boolean |
useFieldAccessors()
Returns true if we should use the generated field marshaller methods that allow us to work around our inability to read and write protected and private fields of a Streamable. |
abstract void |
writeField(Field field,
Object source,
ObjectOutputStream out)
Writes the contents of the supplied field in the supplied object to the supplied stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final String _type
protected static Map<Class<?>,FieldMarshaller> _marshallers
protected static FieldMarshaller _internMarshaller
protected static final Class<?>[] READER_ARGS
protected static final Class<?>[] WRITER_ARGS
| Constructor Detail |
|---|
public FieldMarshaller()
public FieldMarshaller(String type)
| Method Detail |
|---|
public abstract void readField(Field field,
Object target,
ObjectInputStream in)
throws Exception
Exception
public abstract void writeField(Field field,
Object source,
ObjectOutputStream out)
throws Exception
Exceptionpublic String toString()
toString in class Objectpublic static FieldMarshaller getFieldMarshaller(Field field)
public static final String getReaderMethodName(String field)
public static final String getWriterMethodName(String field)
protected static boolean useFieldAccessors()
Streamable.
protected static Map<Class<?>,FieldMarshaller> createMarshallers()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||