Pivotal GemFire Native .NET Reference  10.0.5
Apache::Geode::Client::ReflectionBasedAutoSerializer Class Reference

More...

Inherits Apache::Geode::Client::IPdxSerializer.

Public Member Functions

virtual Object ^ CreateObject (String^ className, Cache^ cache)
 Overirde this method to create default instance of

className

Otherwise it will create instance using zer arg public constructor More...

 
virtual Object ^ FromData (String^ o, IPdxReader^ reader)
 Deserialize this object. More...
 
virtual String ^ GetFieldName (FieldInfo^ fi, Type^ type)
 Controls the field name that will be used in pdx for a field being auto serialized. More...
 
virtual FieldType GetFieldType (FieldInfo^ fi, Type^ type)
 Controls what pdx field type will be used when auto serializing. More...
 
virtual bool IsFieldIncluded (FieldInfo^ fi, Type^ type)
 Controls what fields of a class will be auto serialized by this serializer. More...
 
virtual bool IsIdentityField (FieldInfo^ fi, Type^ type)
 Controls what fields of a class that is auto serialized will be marked as pdx identity fields. More...
 
virtual Object ^ ReadTransform (FieldInfo^ fi, Type^ type, Object^ serializeValue)
 Controls what field value is read during auto deserialization. More...
 
virtual bool ToData (Object^ o, IPdxWriter^ writer)
 Serializes this object in geode PDX format. More...
 
virtual Object ^ WriteTransform (FieldInfo^ fi, Type^ type, Object^ originalValue)
 Controls what field value is written during auto serialization. More...
 

Detailed Description

This class uses .NET reflection in conjunction with IPdxSerializer to perform automatic serialization of domain objects. The implication is that the domain classes do not need to implement the interface. This implementation will serialize all relevant fields. This will not serialize the fields which has defined attribute NonSerialized. This will not serialize the static, literal and readonly fields.

Use to define member field as identity field. Identity fields are used for hashcode creation and equals methods.

Member Function Documentation

◆ CreateObject()

virtual Object ^ Apache::Geode::Client::ReflectionBasedAutoSerializer::CreateObject ( String^  className,
Cache cache 
)
virtual

Overirde this method to create default instance of

className

Otherwise it will create instance using zer arg public constructor

Parameters
classNamename of the class to create default instance
Returns
the defaulf instance

◆ FromData()

virtual Object ^ Apache::Geode::Client::ReflectionBasedAutoSerializer::FromData ( String^  classname,
IPdxReader reader 
)
virtual

Deserialize this object.

Parameters
classnamethe classname whose object need to de-serialize
readerthe IPdxReader stream to use for reading the object data

Implements Apache::Geode::Client::IPdxSerializer.

◆ GetFieldName()

virtual String ^ Apache::Geode::Client::ReflectionBasedAutoSerializer::GetFieldName ( FieldInfo^  fi,
Type^  type 
)
virtual

Controls the field name that will be used in pdx for a field being auto serialized.

Override this method to customize the field names that will be generated by auto serialization. It allows you to convert a local, language dependent name, to a more portable name. The returned name is the one that will show up in a IPdxInstance and that one that will need to be used to access the field when doing a query.

The default implementation returns the name obtained from fi.

This method is only called the first time it sees a new class. The result will be remembered and used the next time the same class is seen.

Parameters
fithe field whose name is returned.

<param name"type"> type the original class being serialized that owns this field.

Returns
the name of the field

◆ GetFieldType()

virtual FieldType Apache::Geode::Client::ReflectionBasedAutoSerializer::GetFieldType ( FieldInfo^  fi,
Type^  type 
)
virtual

Controls what pdx field type will be used when auto serializing.

Override this method to customize what pdx field type will be used for a given domain class field.

The default implementation uses type of field.

This method is only called the first time it sees a new class. The result will be remembered and used the next time the same class is seen.

Parameters
fithe field whose pdx field type needs to be determined
typethe original class being serialized that owns this field.
Returns
the pdx field type of the given domain class field.


◆ IsFieldIncluded()

virtual bool Apache::Geode::Client::ReflectionBasedAutoSerializer::IsFieldIncluded ( FieldInfo^  fi,
Type^  type 
)
virtual

Controls what fields of a class will be auto serialized by this serializer.

Override this method to customize what fields of a class will be auto serialized. The default implementation:

  • excludes NonSerialized fields
  • excludes static fields
  • excludes literal fields
  • excludes readonly fields

All other fields are included. This method is only called the first time it sees a new class. The result will be remembered and used the next time the same class is seen.

Parameters
fithe field being considered for serialization
typethe original class being serialized that owns this field.
Returns
true if the field should be serialized as a pdx field; false if it should be ignored.

◆ IsIdentityField()

virtual bool Apache::Geode::Client::ReflectionBasedAutoSerializer::IsIdentityField ( FieldInfo^  fi,
Type^  type 
)
virtual

Controls what fields of a class that is auto serialized will be marked as pdx identity fields.

Override this method to customize what fields of an auto serialized class will be identity fields. Identity fields are used when a IPdxInstance computes its hash code and checks to see if it is equal to another object.

The default implementation only marks fields that match an "#identity=" pattern as identity fields.

This method is only called the first time it sees a new class. The result will be remembered and used the next time the same class is seen.

Parameters
fithe field to test to see if it is an identity field.
typethe original class being serialized that owns this field.
Returns
true if the field should be marked as an identity field; false if not.

◆ ReadTransform()

virtual Object ^ Apache::Geode::Client::ReflectionBasedAutoSerializer::ReadTransform ( FieldInfo^  fi,
Type^  type,
Object^  serializeValue 
)
virtual

Controls what field value is read during auto deserialization.

Override this method to customize the data that will be read during auto deserialization. This method will only be called if transformFieldValue returned true.

Parameters
fithe field in question
typethe original class being serialized that owns this field. Note that this field may have been inherited from a super class by this class.

the value of the field that was serialized for this field.

Returns
the actual value to write for this field. Return
serializedValue
if you decide not to transform the value.


◆ ToData()

virtual bool Apache::Geode::Client::ReflectionBasedAutoSerializer::ToData ( Object^  o,
IPdxWriter writer 
)
virtual

Serializes this object in geode PDX format.

Parameters
othe object which need to serialize
writerthe IPdxWriter object to use for serializing the object

Implements Apache::Geode::Client::IPdxSerializer.

◆ WriteTransform()

virtual Object ^ Apache::Geode::Client::ReflectionBasedAutoSerializer::WriteTransform ( FieldInfo^  fi,
Type^  type,
Object^  originalValue 
)
virtual

Controls what field value is written during auto serialization.

Override this method to customize the data that will be written during auto serialization.

Parameters
fithe field in question
typethe original class being serialized that owns this field.
originalValuethe value of the field that was read from the domain object.


Returns
the actual value to write for this field. Return
originalValue
if you decide not to transform the value.

Apache Geode C++ Cache .NET API Documentation