Gemfire JavaDocs_test
Interface PdxReader
-
public interface PdxReader
A PdxReader will be passed tofromData
orPdxSerializer 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 isnull
and for primitives it is0
or0.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.
- Since:
- GemFire 6.6
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
hasField(java.lang.String fieldName)
Checks if the named field exists and returns the result.boolean
isIdentityField(java.lang.String fieldName)
Checks if the named field wasmarked
as an identity field.byte[][]
readArrayOfByteArrays(java.lang.String fieldName)
Reads the named field and returns its value.boolean
readBoolean(java.lang.String fieldName)
Reads the named field and returns its value.boolean[]
readBooleanArray(java.lang.String fieldName)
Reads the named field and returns its value.byte
readByte(java.lang.String fieldName)
Reads the named field and returns its value.byte[]
readByteArray(java.lang.String fieldName)
Reads the named field and returns its value.char
readChar(java.lang.String fieldName)
Reads the named field and returns its value.char[]
readCharArray(java.lang.String fieldName)
Reads the named field and returns its value.java.util.Date
readDate(java.lang.String fieldName)
Reads the named field and returns its value.double
readDouble(java.lang.String fieldName)
Reads the named field and returns its value.double[]
readDoubleArray(java.lang.String fieldName)
Reads the named field and returns its value.java.lang.Object
readField(java.lang.String fieldName)
Reads the named field and returns its value.float
readFloat(java.lang.String fieldName)
Reads the named field and returns its value.float[]
readFloatArray(java.lang.String fieldName)
Reads the named field and returns its value.int
readInt(java.lang.String fieldName)
Reads the named field and returns its value.int[]
readIntArray(java.lang.String fieldName)
Reads the named field and returns its value.long
readLong(java.lang.String fieldName)
Reads the named field and returns its value.long[]
readLongArray(java.lang.String fieldName)
Reads the named field and returns its value.java.lang.Object
readObject(java.lang.String fieldName)
Reads the named field and returns its value.java.lang.Object[]
readObjectArray(java.lang.String fieldName)
Reads the named field and returns its value.short
readShort(java.lang.String fieldName)
Reads the named field and returns its value.short[]
readShortArray(java.lang.String fieldName)
Reads the named field and returns its value.java.lang.String
readString(java.lang.String fieldName)
Reads the named field and returns its value.java.lang.String[]
readStringArray(java.lang.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 towriteUnreadFields
in the toData code.
-
-
-
Method Detail
-
readChar
char readChar(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxFieldTypeMismatchException
- if the named field exists and is not achar
field.PdxSerializationException
- if deserialization of the field fails.
-
readBoolean
boolean readBoolean(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxFieldTypeMismatchException
- if the named field exists and is not aboolean
field.PdxSerializationException
- if deserialization of the field fails.
-
readByte
byte readByte(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxFieldTypeMismatchException
- if the named field exists and is not abyte
field.PdxSerializationException
- if deserialization of the field fails.
-
readShort
short readShort(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxFieldTypeMismatchException
- if the named field exists and is not ashort
field.PdxSerializationException
- if deserialization of the field fails.
-
readInt
int readInt(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxFieldTypeMismatchException
- if the named field exists and is not aint
field.PdxSerializationException
- if deserialization of the field fails.
-
readLong
long readLong(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxFieldTypeMismatchException
- if the named field exists and is not along
field.PdxSerializationException
- if deserialization of the field fails.
-
readFloat
float readFloat(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxFieldTypeMismatchException
- if the named field exists and is not afloat
field.PdxSerializationException
- if deserialization of the field fails.
-
readDouble
double readDouble(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxFieldTypeMismatchException
- if the named field exists and is not adouble
field.PdxSerializationException
- if deserialization of the field fails.
-
readString
java.lang.String readString(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxFieldTypeMismatchException
- if the named field exists and is not aString
field.PdxSerializationException
- if deserialization of the field fails.
-
readObject
java.lang.Object readObject(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not anObject
field.
-
readCharArray
char[] readCharArray(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not achar[]
field.
-
readBooleanArray
boolean[] readBooleanArray(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not aboolean[]
field.
-
readByteArray
byte[] readByteArray(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not abyte[]
field.
-
readShortArray
short[] readShortArray(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not ashort[]
field.
-
readIntArray
int[] readIntArray(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not aint[]
field.
-
readLongArray
long[] readLongArray(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not along[]
field.
-
readFloatArray
float[] readFloatArray(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not afloat[]
field.
-
readDoubleArray
double[] readDoubleArray(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not adouble[]
field.
-
readStringArray
java.lang.String[] readStringArray(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not aString[]
field.
-
readObjectArray
java.lang.Object[] readObjectArray(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not aObject[]
field.
-
readArrayOfByteArrays
byte[][] readArrayOfByteArrays(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not abyte[][]
field.
-
readDate
java.util.Date readDate(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxSerializationException
- if deserialization of the field fails.PdxFieldTypeMismatchException
- if the named field exists and is not aDate
field.
-
hasField
boolean hasField(java.lang.String fieldName)
Checks if the named field exists and returns the result.This can be useful when writing code that handles more than one version of a PDX class.
- Parameters:
fieldName
- the name of the field to check- Returns:
true
if the named field exists; otherwisefalse
-
isIdentityField
boolean isIdentityField(java.lang.String fieldName)
Checks if the named field wasmarked
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.- Parameters:
fieldName
- the name of the field to check- Returns:
true
if the named field exists and was marked as an identify field; otherwisefalse
-
readField
java.lang.Object readField(java.lang.String fieldName)
Reads the named field and returns its value.- Parameters:
fieldName
- the name of the field to read- Returns:
- the value of the field if the field exists; otherwise a default value
- Throws:
PdxSerializationException
- if deserialization of the field fails.
-
readUnreadFields
PdxUnreadFields readUnreadFields()
This method returns an object that represents all the unread fields which must be passed towriteUnreadFields
in the toData code.Note that if
setPdxIgnoreUnreadFields
orclient setPdxIgnoreUnreadFields
are set totrue
then this method will always return an object that has no unread fields.- Returns:
- an object that represents the unread fields.
-
-