CrystalJsonTypeResolver
Namespace: SnowBank.Data.Json · class
Implements: ICrystalJsonTypeResolver
Default JSON resolver that uses reflection to serialize and deserialize managed types
Constructors
CrystalJsonTypeResolver
CrystalJsonTypeResolver()
Methods
BindJsonArray
object BindJsonArray(Type type, JsonArray array)
BindJsonObject
object BindJsonObject(Type type, JsonObject value)
BindJsonValue
object BindJsonValue(Type type, JsonValue value)
FillArray
static TOutput[] FillArray<TInput, TOutput>(IList<TInput> array, Func<Type, TInput, object> convert)
FillConcurrentBag
static ConcurrentBag<TOutput> FillConcurrentBag<TInput, TOutput>(IList<TInput> array, Func<Type, TInput, object> convert)
FillConcurrentQueue
static ConcurrentQueue<TOutput> FillConcurrentQueue<TInput, TOutput>(IList<TInput> array, Func<Type, TInput, object> convert)
FillConcurrentStack
static ConcurrentStack<TOutput> FillConcurrentStack<TInput, TOutput>(IList<TInput> array, Func<Type, TInput, object> convert)
FillEnumerable
static IEnumerable<TOutput> FillEnumerable<TInput, TOutput>(IList<TInput> array, Func<Type, TInput, object> convert)
FillHashSet
static HashSet<TOutput> FillHashSet<TInput, TOutput>(IList<TInput> array, Func<Type, TInput, object> convert)
FillImmutableArray
static ImmutableArray<TOutput> FillImmutableArray<TInput, TOutput>(IList<TInput> array, Func<Type, TInput, object> convert)
FillImmutableHashSet
static ImmutableHashSet<TOutput> FillImmutableHashSet<TInput, TOutput>(IList<TInput> array, Func<Type, TInput, object> convert)
FillImmutableList
static ImmutableList<TOutput> FillImmutableList<TInput, TOutput>(IList<TInput> array, Func<Type, TInput, object> convert)
FillImmutableSortedSet
static ImmutableSortedSet<TOutput> FillImmutableSortedSet<TInput, TOutput>(IList<TInput> array, Func<Type, TInput, object> convert)
FillList
static List<TOutput> FillList<TInput, TOutput>(IList<TInput> array, Func<Type, TInput, object> convert)
FillQueue
static Queue<TOutput> FillQueue<TInput, TOutput>(IList<TInput> array, Func<Type, TInput, object> convert)
FillReadOnlyCollection
static ReadOnlyCollection<TOutput> FillReadOnlyCollection<TInput, TOutput>(IList<TInput> array, Func<Type, TInput, object> convert)
FillStack
static Stack<TOutput> FillStack<TInput, TOutput>(IList<TInput> array, Func<Type, TInput, object> convert)
GetConverterFor
static IJsonConverter<T> GetConverterFor<T>()
static IJsonConverter<T> GetConverterFor<T>(ICrystalJsonTypeResolver resolver)
static IJsonConverter GetConverterFor(Type type)
static IJsonConverter GetConverterFor(Type type, ICrystalJsonTypeResolver resolver)
GetNullableType
static Type GetNullableType(Type type)
IsInitOnlyMember
static bool IsInitOnlyMember(MemberInfo member)
Tests if a member is a readonly field, or an init-only property
IsKeyMember
static bool IsKeyMember(MemberInfo member)
Tests if a member of a type is decorated with KeyAttribute
IsNotNullMemberType
static bool IsNotNullMemberType(MemberInfo member, Type memberType)
Tests if a member of a type is decorated with the required keyword
IsNullableType
static bool IsNullableType(Type type)
IsRequiredMember
static bool IsRequiredMember(MemberInfo member)
Tests if a member of a type is decorated with the required keyword
IsSealedType
static bool IsSealedType(Type type)
ResolveJsonType
CrystalJsonTypeDefinition ResolveJsonType(Type type)
Inspects a type to retrieve the definitions of its members
type— Type to inspect
Returns: List of compiled member definitions, or null if the type is not compatible
The list is cached for later calls
ResolveMemberOfType
CrystalJsonMemberDefinition ResolveMemberOfType(Type type, string memberName)
TryGetConverterFor
bool TryGetConverterFor<T>(out IJsonConverter<T> converter)
Returns the converter for the given type in this collection
converter— Receives the converter for this type, if it is managed by this collection
Returns: true if this collection handles this type; otherwise, false
bool TryGetConverterFor(Type type, out IJsonConverter converter)
Returns the converter for the given type in this collection
type— Type of values that needs to be convertedconverter— Receives the converter for this type, if it is managed by this collection
Returns: true if this collection handles this type; otherwise, false
TryResolveMember
bool TryResolveMember<T>(string memberName, out CrystalJsonMemberDefinition definition)
Returns the definition for the specified member of a type
bool TryResolveMember(Type type, string memberName, out CrystalJsonMemberDefinition definition)
Returns the definition for the specified member of a type
TryResolveTypeDefinition
bool TryResolveTypeDefinition<T>(out CrystalJsonTypeDefinition definition)
Returns the type definition for the specified type
definition— Receives the definition for this type, if it is known by this resolver
Returns: true if the resolver can handle this type; otherwise, false
bool TryResolveTypeDefinition(Type type, out CrystalJsonTypeDefinition definition)
Returns the type definition for the specified type
type— Type to inspectdefinition— Receives the definition for this type, if it is known by this resolver
Returns: true if the resolver can handle this type; otherwise, false