public interface PdxReader
fromData
or
PdxSerializer fromData
by GemFire during
deserialization of a PDX. The domain class needs to deserialize field members using this
interface. This interface is implemented by GemFire. Each readXXX call will return the field's
value. If the serialized PDX does not contain the named field then a default value will be
returned. Standard Java defaults are used. For Objects this is null
and for
primitives it is 0
or 0.0
.
You must read fields in the same order they were written by PdxWriter
.
The methods on this interface are not thread safe so do not call them concurrently, on the same instance, from more than one thread.
Modifier and Type | Method and Description |
---|---|
boolean |
hasField(String fieldName)
Checks if the named field exists and returns the result.
|
boolean |
isIdentityField(String fieldName)
Checks if the named field was
marked as an identity
field. |
byte[][] |
readArrayOfByteArrays(String fieldName)
Reads the named field and returns its value.
|
boolean |
readBoolean(String fieldName)
Reads the named field and returns its value.
|
boolean[] |
readBooleanArray(String fieldName)
Reads the named field and returns its value.
|
byte |
readByte(String fieldName)
Reads the named field and returns its value.
|
byte[] |
readByteArray(String fieldName)
Reads the named field and returns its value.
|
char |
readChar(String fieldName)
Reads the named field and returns its value.
|
char[] |
readCharArray(String fieldName)
Reads the named field and returns its value.
|
Date |
readDate(String fieldName)
Reads the named field and returns its value.
|
double |
readDouble(String fieldName)
Reads the named field and returns its value.
|
double[] |
readDoubleArray(String fieldName)
Reads the named field and returns its value.
|
Object |
readField(String fieldName)
Reads the named field and returns its value.
|
float |
readFloat(String fieldName)
Reads the named field and returns its value.
|
float[] |
readFloatArray(String fieldName)
Reads the named field and returns its value.
|
int |
readInt(String fieldName)
Reads the named field and returns its value.
|
int[] |
readIntArray(String fieldName)
Reads the named field and returns its value.
|
long |
readLong(String fieldName)
Reads the named field and returns its value.
|
long[] |
readLongArray(String fieldName)
Reads the named field and returns its value.
|
Object |
readObject(String fieldName)
Reads the named field and returns its value.
|
Object[] |
readObjectArray(String fieldName)
Reads the named field and returns its value.
|
short |
readShort(String fieldName)
Reads the named field and returns its value.
|
short[] |
readShortArray(String fieldName)
Reads the named field and returns its value.
|
String |
readString(String fieldName)
Reads the named field and returns its value.
|
String[] |
readStringArray(String fieldName)
Reads the named field and returns its value.
|
PdxUnreadFields |
readUnreadFields()
This method returns an object that represents all the unread fields which must be passed to
writeUnreadFields in the toData code. |
char readChar(String fieldName)
fieldName
- the name of the field to readPdxFieldTypeMismatchException
- if the named field exists and is not a char
field.PdxSerializationException
- if deserialization of the field fails.boolean readBoolean(String fieldName)
fieldName
- the name of the field to readPdxFieldTypeMismatchException
- if the named field exists and is not a
boolean
field.PdxSerializationException
- if deserialization of the field fails.byte readByte(String fieldName)
fieldName
- the name of the field to readPdxFieldTypeMismatchException
- if the named field exists and is not a byte
field.PdxSerializationException
- if deserialization of the field fails.short readShort(String fieldName)
fieldName
- the name of the field to readPdxFieldTypeMismatchException
- if the named field exists and is not a short
field.PdxSerializationException
- if deserialization of the field fails.int readInt(String fieldName)
fieldName
- the name of the field to readPdxFieldTypeMismatchException
- if the named field exists and is not a int
field.PdxSerializationException
- if deserialization of the field fails.long readLong(String fieldName)
fieldName
- the name of the field to readPdxFieldTypeMismatchException
- if the named field exists and is not a long
field.PdxSerializationException
- if deserialization of the field fails.float readFloat(String fieldName)
fieldName
- the name of the field to readPdxFieldTypeMismatchException
- if the named field exists and is not a float
field.PdxSerializationException
- if deserialization of the field fails.double readDouble(String fieldName)
fieldName
- the name of the field to readPdxFieldTypeMismatchException
- if the named field exists and is not a
double
field.PdxSerializationException
- if deserialization of the field fails.String readString(String fieldName)
fieldName
- the name of the field to readPdxFieldTypeMismatchException
- if the named field exists and is not a
String
field.PdxSerializationException
- if deserialization of the field fails.Object readObject(String fieldName)
fieldName
- the name of the field to readPdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not an
Object
field.char[] readCharArray(String fieldName)
fieldName
- the name of the field to readPdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not a
char[]
field.boolean[] readBooleanArray(String fieldName)
fieldName
- the name of the field to readPdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not a
boolean[]
field.byte[] readByteArray(String fieldName)
fieldName
- the name of the field to readPdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not a
byte[]
field.short[] readShortArray(String fieldName)
fieldName
- the name of the field to readPdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not a
short[]
field.int[] readIntArray(String fieldName)
fieldName
- the name of the field to readPdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not a int[]
field.long[] readLongArray(String fieldName)
fieldName
- the name of the field to readPdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not a
long[]
field.float[] readFloatArray(String fieldName)
fieldName
- the name of the field to readPdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not a
float[]
field.double[] readDoubleArray(String fieldName)
fieldName
- the name of the field to readPdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not a
double[]
field.String[] readStringArray(String fieldName)
fieldName
- the name of the field to readPdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not a
String[]
field.Object[] readObjectArray(String fieldName)
fieldName
- the name of the field to readPdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not a
Object[]
field.byte[][] readArrayOfByteArrays(String fieldName)
fieldName
- the name of the field to readPdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not a
byte[][]
field.Date readDate(String fieldName)
fieldName
- the name of the field to readPdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not a Date
field.boolean hasField(String fieldName)
This can be useful when writing code that handles more than one version of a PDX class.
fieldName
- the name of the field to checktrue
if the named field exists; otherwise false
boolean isIdentityField(String fieldName)
marked
as an identity
field.
Note that if no fields have been marked then all the fields are used as identity fields even
though this method will return false
since none of them have been marked.
fieldName
- the name of the field to checktrue
if the named field exists and was marked as an identify field;
otherwise false
Object readField(String fieldName)
fieldName
- the name of the field to readPdxSerializationException
- if deserialization of the field fails.PdxUnreadFields readUnreadFields()
writeUnreadFields
in the toData code.
Note that if setPdxIgnoreUnreadFields
or
client setPdxIgnoreUnreadFields
are set to true
then this method will always
return an object that has no unread fields.