Class AnonymizedJsonContractResolver
Applies declared anonymizers to property values when serializing data to JSON.
Inheritance
Namespace: Sensus.Anonymization
Assembly: SensusAndroid.dll
Syntax
public class AnonymizedJsonContractResolver : DefaultContractResolver
Constructors
AnonymizedJsonContractResolver(Protocol)
Declaration
public AnonymizedJsonContractResolver(Protocol protocol)
Parameters
Type | Name | Description |
---|---|---|
Protocol | protocol |
Properties
PropertyStringAnonymizerString
Allows JSON serialization of the _propertyAnonymizer collection, which includes unserializable PropertyInfo objects. Store the type/name of the PropertyInfo objects, along with the type of anonymizer.
Declaration
public ObservableCollection<string> PropertyStringAnonymizerString { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ObservableCollection<System.String> | The property string anonymizer string. |
Protocol
Declaration
public Protocol Protocol { get; set; }
Property Value
Type | Description |
---|---|
Protocol |
Methods
CreateMemberValueProvider(MemberInfo)
Creates a value provider for a member. Only works for PropertyInfo members and will throw an exception for all other members.
Declaration
protected override IValueProvider CreateMemberValueProvider(MemberInfo member)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.MemberInfo | member | Member. |
Returns
Type | Description |
---|---|
Newtonsoft.Json.Serialization.IValueProvider | The member value provider. |
CreateProperties(Type, MemberSerialization)
Gets a list of properties of a type that should be serialized. The purpose of this class is to anonymize Datum objects and their child classes; however, if a Datum (or child) class contains serializable properties involving other classes, those types will also be processed with this method as well as CreateMemberValueProvider. So, don't assume that the properties will always come from Datum-based classes.
Declaration
protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Type. |
Newtonsoft.Json.MemberSerialization | memberSerialization | Member serialization. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<Newtonsoft.Json.Serialization.JsonProperty> | The properties. |
GetAnonymizer(PropertyInfo)
Declaration
public Anonymizer GetAnonymizer(PropertyInfo property)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.PropertyInfo | property |
Returns
Type | Description |
---|---|
Anonymizer |
SetAnonymizer(PropertyInfo, Anonymizer)
Declaration
public void SetAnonymizer(PropertyInfo property, Anonymizer anonymizer)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.PropertyInfo | property | |
Anonymizer | anonymizer |