public interface PdxInstance extends Serializable
cache.xml by setting the
 attribute read-serialized to true on the pdx element. Or it can be done
 programmatically using either the setPdxReadSerialized or client
 setPdxReadSerialized method. Once this preference is configured, then any time deserialization
 of a PDX is done it will deserialize into a PdxInstance.
 
 PdxInstances are immutable. If you want to change one call createWriter().
 
A PdxInstance's fields will always be those of the version it represents. So if you add a field to your domain class you can end up with a PdxInstance for version 1 (that does not have the field) and a PdxInstance for version 2. The PdxInstance for version 1 will not have the added field and the PdxInstance for version 2 will have the field. This differs from deserialization of a pdx back to a domain class. In that case if version 2 is deserializing version 1 PdxReader will return a default value for the added field even though version 1 has no knowledge of it.
| Modifier and Type | Method and Description | 
|---|---|
| WritablePdxInstance | createWriter()Creates and returns a  WritablePdxInstancewhose initial values are those of this
 PdxInstance. | 
| boolean | equals(Object other)Returns true if the given object is equals to this instance. | 
| String | getClassName()Return the full name of the class that this pdx instance represents. | 
| Object | getField(String fieldName)Reads the named field and returns its value. | 
| List<String> | getFieldNames()Return an unmodifiable list of the field names on this PdxInstance. | 
| Object | getObject()Deserializes and returns the domain object that this instance represents. | 
| boolean | hasField(String fieldName)Checks if the named field exists and returns the result. | 
| int | hashCode()Generates a hashCode based on the identity fields of this PdxInstance. | 
| default boolean | isDeserializable()Returns false if this instance will never be deserialized to a domain class. | 
| boolean | isEnum()Returns true if this instance represents an enum. | 
| boolean | isIdentityField(String fieldName)Checks if the named field was  markedas an identity
 field. | 
| String | toString()Prints out all of the identity fields of this PdxInstance. | 
String getClassName()
boolean isEnum()
Comparable. PdxInstances representing enums are not writable.Object getObject()
PdxSerializationException - if the instance could not be deserializedboolean 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 falseList<String> getFieldNames()
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 falseObject getField(String fieldName)
null is
 returned.
 
 A null result indicates that the field does not exist or that it exists and its
 value is currently null. The hasField method can be used
 to figure out which if these two cases is true.
 
 If an Object[] is deserialized by this call then that array's component type will be
 Object.class instead of the original class that the array had when it was
 serialized. This is done so that PdxInstance objects can be added to the array.
fieldName - name of the field to readnull is returned.PdxSerializationException - if the field could not be deserializedboolean equals(Object other)
 If other is not a PdxInstance then it is not equal to this instance. NOTE: Even if
 other is the result of calling getObject() it will not be equal to this
 instance.
 
Otherwise equality of two PdxInstances is determined as follows:
markIdentityField then only the marked identity
 fields are its identity fields. Otherwise all its fields are identity fields.
 An identity field is equal if all the following are true:
 If a field's type is OBJECT then its value must be deserialized to determine if it
 is equals. If the deserialized object is an array then
 deepEquals is used to determine
 equality. Otherwise equals is used.
 
 If a field's type is OBJECT[] then its value must be deserialized and
 deepEquals is used to determine
 equality.
 
For all other field types then the value does not need to be deserialized. Instead the serialized raw bytes are compared and used to determine equality.
 Note that any fields that have objects that do not override equals will cause equals to return false when you might have expected it to return true. The
 only exceptions to this are those that call
 deepEquals as noted above. You should
 either override equals and hashCode in these cases or mark other fields as your identity
 fields.
int hashCode()
 If a PdxInstance has marked identity fields using markIdentityField then only the marked identity fields are its identity fields. Otherwise all
 its fields are identity fields.
 
 If an identity field is of type OBJECT then it is deserialized. If the
 deserialized object is an array then deepHashCode is used. Otherwise hashCode is used.
 
 If an identity field is of type OBJECT[] this it is deserialized and
 deepHashCode is used.
 
Otherwise the field is not deserialized and the raw bytes of its value are used to compute the hash code.
The algorithm used to compute the hashCode is: hashCode = 1; foreach (field: sortedIdentityFields()) { if (field.isDefaultValue()) continue; if (field.isArray()) { hashCode = hashCode*31 + Arrays.deepHashCode(field); } else { hashCode = hashCode*31 + field.hashCode(); } } if (hashCode == 0) { hashCode = 1; }
String toString()
 If a PdxInstance has marked identity fields using markIdentityField then only the marked identity fields are its identity fields. Otherwise all
 its fields are identity fields.
WritablePdxInstance createWriter()
WritablePdxInstance whose initial values are those of this
 PdxInstance. This call returns a copy of the current field values so modifications made to the
 returned value will not modify this PdxInstance.WritablePdxInstanceIllegalStateException - if the PdxInstance is an enum.default boolean isDeserializable()
PdxInstanceFactory.neverDeserialize() or by creating a factory with
 an empty string as the class name.