GemStone::GemFire::Cache::Generic::Internal::PdxInstanceImpl Class Reference

Inherits GemStone::GemFire::Cache::Generic::IWritablePdxInstance, GemStone::GemFire::Cache::Generic::IPdxInstance, and GemStone::GemFire::Cache::Generic::IPdxSerializable.


Detailed Description

Serialize the data in gemfire Portable Data eXchange(Pdx) Format. This format provides class versioning(forward and backward compability of types) in cache. This provides ability to query .NET domian objects.

Public Member Functions

virtual
IWritablePdxInstance
CreateWriter ()
virtual bool Equals (Object^ other) override
virtual void FromData (IPdxReader^ reader)
virtual String^ GetClassName ()
virtual Object^ GetField (String^ fieldName)
virtual IList< String^ >^ GetFieldNames ()
virtual int GetHashCode () override
virtual Object^ GetObject ()
virtual bool HasField (String^ fieldName)
virtual bool IsIdentityField (String^ fieldName)
virtual void SetField (String^ fieldName, Object^ value)
virtual void ToData (IPdxWriter^ writer)
virtual String^ ToString () override

Member Function Documentation

virtual IWritablePdxInstance ^ GemStone::GemFire::Cache::Generic::Internal::PdxInstanceImpl::CreateWriter (  )  [virtual]

Creates and returns a 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.

Returns:
a WritablePdxInstance

Implements GemStone::GemFire::Cache::Generic::IPdxInstance.

virtual bool GemStone::GemFire::Cache::Generic::Internal::PdxInstanceImpl::Equals ( Object^   other  )  [override, virtual]

Returns true if the given object is equals to this instance. 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: ol> li>The domain class name must be equal for both PdxInstances li>Each identity field must be equal. /ol> If one of the instances does not have a field that the other one does then equals will assume it has the field with a default value. 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. An identity field is equal if all the following are true: ol> li>The field name is equal. li>The field type is equal. li>The field value is equal. /ol> 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.

Parameters:
other the other instance to compare to this.
Returns:
true if this instance is equal to other.

Implements GemStone::GemFire::Cache::Generic::IPdxInstance.

virtual void GemStone::GemFire::Cache::Generic::Internal::PdxInstanceImpl::FromData ( IPdxReader^   reader  )  [virtual]

Deserialize this object.

Parameters:
reader the IPdxReader stream to use for reading the object data

Implements GemStone::GemFire::Cache::Generic::IPdxSerializable.

virtual String ^ GemStone::GemFire::Cache::Generic::Internal::PdxInstanceImpl::GetClassName (  )  [virtual]

Return the full name of the class that this pdx instance represents.

Returns:
the name of the class that this pdx instance represents.

Implements GemStone::GemFire::Cache::Generic::IPdxInstance.

virtual Object ^ GemStone::GemFire::Cache::Generic::Internal::PdxInstanceImpl::GetField ( String^   fieldName  )  [virtual]

Reads the named field and returns its value. If the field does not exist 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.

Parameters:
fieldName name of the field to read
Returns:
If this instance has the named field then the field's value is returned, otherwise null is returned.
Exceptions:
PdxSerializationException if the field could not be deserialized

Implements GemStone::GemFire::Cache::Generic::IPdxInstance.

virtual IList<String^> ^ GemStone::GemFire::Cache::Generic::Internal::PdxInstanceImpl::GetFieldNames (  )  [virtual]

Return an unmodifiable list of the field names on this PdxInstance.

Returns:
an unmodifiable list of the field names on this PdxInstance

Implements GemStone::GemFire::Cache::Generic::IPdxInstance.

virtual int GemStone::GemFire::Cache::Generic::Internal::PdxInstanceImpl::GetHashCode (  )  [override, virtual]

Generates a hashCode based on the identity fields of this PdxInstance. 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.

Implements GemStone::GemFire::Cache::Generic::IPdxInstance.

virtual Object ^ GemStone::GemFire::Cache::Generic::Internal::PdxInstanceImpl::GetObject (  )  [virtual]

Deserializes and returns the domain object that this instance represents.

Returns:
the deserialized domain object.
Exceptions:
PdxSerializationException if the instance could not be deserialized

Implements GemStone::GemFire::Cache::Generic::IPdxInstance.

virtual bool GemStone::GemFire::Cache::Generic::Internal::PdxInstanceImpl::HasField ( String^   fieldName  )  [virtual]

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; otherwise false

Implements GemStone::GemFire::Cache::Generic::IPdxInstance.

virtual bool GemStone::GemFire::Cache::Generic::Internal::PdxInstanceImpl::IsIdentityField ( String^   fieldName  )  [virtual]

Checks if the named field was 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.

Parameters:
fieldName the name of the field to check
Returns:
true if the named field exists and was marked as an identify field; otherwise false

Implements GemStone::GemFire::Cache::Generic::IPdxInstance.

virtual void GemStone::GemFire::Cache::Generic::Internal::PdxInstanceImpl::SetField ( String^   fieldName,
Object^   value 
) [virtual]

Set the existing named field to the given value. The setField method has copy-on-write semantics. So for the modifications to be stored in the cache the WritablePdxInstance must be put into a region after setField has been called one or more times.

Parameters:
fieldName name of the field whose value will be set
value value that will be assigned to the field
Exceptions:
PdxFieldDoesNotExistException if the named field does not exist
PdxFieldTypeMismatchException if the type of the value is not compatible with the field

Implements GemStone::GemFire::Cache::Generic::IWritablePdxInstance.

virtual void GemStone::GemFire::Cache::Generic::Internal::PdxInstanceImpl::ToData ( IPdxWriter^   writer  )  [virtual]

Serializes this object in gemfire PDX format.

Parameters:
writer the IPdxWriter object to use for serializing the object

Implements GemStone::GemFire::Cache::Generic::IPdxSerializable.

virtual String ^ GemStone::GemFire::Cache::Generic::Internal::PdxInstanceImpl::ToString (  )  [override, virtual]

Prints out all of the identity fields of this PdxInstance. 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.

Implements GemStone::GemFire::Cache::Generic::IPdxInstance.


GemFire C++ Cache .NET API Documentation