GemFire 6.6.3

com.gemstone.gemfire.pdx
Interface PdxWriter


public interface PdxWriter

A PdxWriter will be passed to toData or PdxSerializer toData by GemFire when it is serializing the domain class. The domain class needs to serialize instance fields using this interface. This interface is implemented by GemFire.

The order in which the fields are written must match the order in which they are read by PdxReader.

Field names are case sensitive.

All methods on this interface return itself to allow method calls to be chained together.

Since:
6.6

Method Summary
 PdxWriter markIdentityField(String fieldName)
          Indicate that the named field should be included in hashCode and equals checks of this object on a server that is accessing PdxInstance or when a client executes a query on a server.
 PdxWriter writeArrayOfByteArrays(String fieldName, byte[][] value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeBoolean(String fieldName, boolean value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeBooleanArray(String fieldName, boolean[] value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeByte(String fieldName, byte value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeByteArray(String fieldName, byte[] value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeChar(String fieldName, char value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeCharArray(String fieldName, char[] value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeDate(String fieldName, Date value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeDouble(String fieldName, double value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeDoubleArray(String fieldName, double[] value)
          Writes the named field with the given value to the serialized form.
<CT,VT extends CT>
PdxWriter
writeField(String fieldName, VT fieldValue, Class<CT> fieldType)
          Writes the named field with the given value and type to the serialized form.
<CT,VT extends CT>
PdxWriter
writeField(String fieldName, VT fieldValue, Class<CT> fieldType, boolean checkPortability)
          Writes the named field with the given value and type to the serialized form.
 PdxWriter writeFloat(String fieldName, float value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeFloatArray(String fieldName, float[] value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeInt(String fieldName, int value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeIntArray(String fieldName, int[] value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeLong(String fieldName, long value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeLongArray(String fieldName, long[] value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeObject(String fieldName, Object value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeObject(String fieldName, Object value, boolean checkPortability)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeObjectArray(String fieldName, Object[] value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeObjectArray(String fieldName, Object[] value, boolean checkPortability)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeShort(String fieldName, short value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeShortArray(String fieldName, short[] value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeString(String fieldName, String value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeStringArray(String fieldName, String[] value)
          Writes the named field with the given value to the serialized form.
 PdxWriter writeUnreadFields(PdxUnreadFields unread)
          Writes the given unread fields to the serialized form.
 

Method Detail

writeChar

PdxWriter writeChar(String fieldName,
                    char value)
Writes the named field with the given value to the serialized form. The fields type is char.

Java char is mapped to .NET System.Char.

Parameters:
fieldName - the name of the field to write
value - the value of the field to write
Returns:
this PdxWriter
Throws:
PdxFieldAlreadyExistsException - if the named field has already been written
PdxSerializationException - if serialization of the field fails.

writeBoolean

PdxWriter writeBoolean(String fieldName,
                       boolean value)
Writes the named field with the given value to the serialized form. The fields type is boolean.

Java boolean is mapped to .NET System.Boolean.

Parameters:
fieldName - the name of the field to write
value - the value of the field to write
Returns:
this PdxWriter
Throws:
PdxFieldAlreadyExistsException - if the named field has already been written
PdxSerializationException - if serialization of the field fails.

writeByte

PdxWriter writeByte(String fieldName,
                    byte value)
Writes the named field with the given value to the serialized form. The fields type is byte.

Java byte is mapped to .NET System.SByte.

Parameters:
fieldName - the name of the field to write
value - the value of the field to write
Returns:
this PdxWriter
Throws:
PdxFieldAlreadyExistsException - if the named field has already been written
PdxSerializationException - if serialization of the field fails.

writeShort

PdxWriter writeShort(String fieldName,
                     short value)
Writes the named field with the given value to the serialized form. The fields type is short.

Java short is mapped to .NET System.Int16.

Parameters:
fieldName - the name of the field to write
value - the value of the field to write
Returns:
this PdxWriter
Throws:
PdxFieldAlreadyExistsException - if the named field has already been written
PdxSerializationException - if serialization of the field fails.

writeInt

PdxWriter writeInt(String fieldName,
                   int value)
Writes the named field with the given value to the serialized form. The fields type is int.

Java int is mapped to .NET System.Int32.

Parameters:
fieldName - the name of the field to write
value - the value of the field to write
Returns:
this PdxWriter
Throws:
PdxFieldAlreadyExistsException - if the named field has already been written
PdxSerializationException - if serialization of the field fails.

writeLong

PdxWriter writeLong(String fieldName,
                    long value)
Writes the named field with the given value to the serialized form. The fields type is long.

Java long is mapped to .NET System.Int64.

Parameters:
fieldName - the name of the field to write
value - the value of the field to write
Returns:
this PdxWriter
Throws:
PdxFieldAlreadyExistsException - if the named field has already been written
PdxSerializationException - if serialization of the field fails.

writeFloat

PdxWriter writeFloat(String fieldName,
                     float value)
Writes the named field with the given value to the serialized form. The fields type is float.

Java float is mapped to .NET System.Float.

Parameters:
fieldName - the name of the field to write
value - the value of the field to write
Returns:
this PdxWriter
Throws:
PdxFieldAlreadyExistsException - if the named field has already been written
PdxSerializationException - if serialization of the field fails.

writeDouble

PdxWriter writeDouble(String fieldName,
                      double value)
Writes the named field with the given value to the serialized form. The fields type is double.

Java double is mapped to .NET System.Double.

Parameters:
fieldName - the name of the field to write
value - the value of the field to write
Returns:
this PdxWriter
Throws:
PdxFieldAlreadyExistsException - if the named field has already been written
PdxSerializationException - if serialization of the field fails.

writeDate

PdxWriter writeDate(String fieldName,
                    Date value)
Writes the named field with the given value to the serialized form. The fields type is Date.

Java Date is mapped to .NET System.DateTime.

Parameters:
fieldName - the name of the field to write
value - the value of the field to write
Returns:
this PdxWriter
Throws:
PdxFieldAlreadyExistsException - if the named field has already been written
PdxSerializationException - if serialization of the field fails.

writeString

PdxWriter writeString(String fieldName,
                      String value)
Writes the named field with the given value to the serialized form. The fields type is String.

Java String is mapped to .NET System.String.

Parameters:
fieldName - the name of the field to write
value - the value of the field to write
Returns:
this PdxWriter
Throws:
PdxFieldAlreadyExistsException - if the named field has already been written
PdxSerializationException - if serialization of the field fails.

writeObject

PdxWriter writeObject(String fieldName,
                      Object value)
Writes the named field with the given value to the serialized form. The fields type is Object.

It is best to use one of the other writeXXX methods if your field type will always be XXX. This method allows the field value to be anything that is an instance of Object. This gives you more flexibility but more space is used to store the serialized field.

Note that some Java objects serialized with this method may not be compatible with non-java languages. To ensure that only portable objects are serialized use writeObject(String, Object, boolean).

Parameters:
fieldName - the name of the field to write
value - the value of the field to write
Returns:
this PdxWriter
Throws:
PdxFieldAlreadyExistsException - if the named field has already been written
PdxSerializationException - if serialization of the field fails.

writeObject

PdxWriter writeObject(String fieldName,
                      Object value,
                      boolean checkPortability)
Writes the named field with the given value to the serialized form. The fields type is Object.

It is best to use one of the other writeXXX methods if your field type will always be XXX. This method allows the field value to be anything that is an instance of Object. This gives you more flexibility but more space is used to store the serialized field.

Note that some Java objects serialized with this method may not be compatible with non-java languages. To ensure that only portable objects are serialized set the checkPortability parameter to true. The following is a list of the Java classes that are portable and the .NET class they are mapped to: