VMware GemFire Native Client .NET Framework API Reference
|
VMware VMware GemFire Native .NET Reference 10.4.3
|
This class uses .NET reflection in conjunction with IPdxSerializer to perform automatic serialization of domain objects. More...
#include <ReflectionBasedAutoSerializer.hpp>
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. | |
| virtual Object ^ | FromData (String^ o, IPdxReader^ reader) |
| Deserialize this object. | |
| virtual String ^ | GetFieldName (FieldInfo^ fi, Type^ type) |
| Controls the field name that will be used in pdx for a field being auto serialized. | |
| virtual FieldType | GetFieldType (FieldInfo^ fi, Type^ type) |
| Controls what pdx field type will be used when auto serializing. | |
| virtual bool | IsFieldIncluded (FieldInfo^ fi, Type^ type) |
| Controls what fields of a class will be auto serialized by this serializer. | |
| virtual bool | IsIdentityField (FieldInfo^ fi, Type^ type) |
| Controls what fields of a class that is auto serialized will be marked as pdx identity fields. | |
| virtual Object ^ | ReadTransform (FieldInfo^ fi, Type^ type, Object^ serializeValue) |
| Controls what field value is read during auto deserialization. | |
| virtual bool | ToData (Object^ o, IPdxWriter^ writer) |
| Serializes this object in geode PDX format. | |
| virtual Object ^ | WriteTransform (FieldInfo^ fi, Type^ type, Object^ originalValue) |
| Controls what field value is written during auto serialization. | |
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.
Member Function Documentation
◆ CreateObject()
|
virtual |
Overirde this method to create default instance of className Otherwise it will create instance using zer arg public constructor.
- Parameters
-
className name of the class to create default instance
- Returns
- the defaulf instance
◆ FromData()
|
virtual |
Deserialize this object.
- Parameters
-
classname the classname whose object need to de-serialize reader the IPdxReader stream to use for reading the object data
Implements Apache::Geode::Client::IPdxSerializer.
◆ GetFieldName()
|
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
-
fi the 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 |
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
-
fi the field whose pdx field type needs to be determined type the original class being serialized that owns this field.
- Returns
- the pdx field type of the given domain class field.
◆ IsFieldIncluded()
|
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
-
fi the field being considered for serialization type the 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 |
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
-
fi the field to test to see if it is an identity field. type the 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 |
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
-
fi the field in question type the 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 if you decide not to transform the value.serializedValue
◆ ToData()
|
virtual |
Serializes this object in geode PDX format.
- Parameters
-
o the object which need to serialize writer the IPdxWriter object to use for serializing the object
Implements Apache::Geode::Client::IPdxSerializer.
◆ WriteTransform()
|
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
-
fi the field in question type the original class being serialized that owns this field. originalValue the value of the field that was read from the domain object.
- Returns
- the actual value to write for this field. Return if you decide not to transform the value.originalValue
Apache Geode C++ Cache .NET API Documentation