Exemplo n.º 1
0
 public ObjectDictionaryMapper(
     IJsonSerializator <TKey> keySerializator, IJsonSerializator <TValue> valueSerializator) :
     base(
         keySerializator, valueSerializator,
         JsonLiterals.ObjectStart, JsonLiterals.ObjectEnd,
         JsonToken.ObjectStart, JsonToken.ObjectEmpty, JsonToken.ObjectEnd)
 {
 }
Exemplo n.º 2
0
 public ArrayDictionaryMapper(
     IJsonSerializator <TKey> keySerializator, IJsonSerializator <TValue> valueSerializator) :
     base(
         keySerializator, valueSerializator,
         JsonLiterals.ArrayStart, JsonLiterals.ArrayEnd,
         JsonToken.ArrayStart, JsonToken.ArrayEmpty, JsonToken.ArrayEnd)
 {
 }
Exemplo n.º 3
0
 private IJsonMapper <SortedList <TKey, TValue> > BuildReflectionInvoke <TKey, TValue>(
     IJsonSerializator <TKey> keySerializator, IJsonSerializator <TValue> valueSerializator)
 {
     if (typeof(TKey) == StringType)
     {
         return(new ObjectDictionaryMapper <SortedList <TKey, TValue>, SortedList <TKey, TValue>, TKey, TValue>(
                    keySerializator, valueSerializator));
     }
     return(new ArrayDictionaryMapper <SortedList <TKey, TValue>, SortedList <TKey, TValue>, TKey, TValue>(
                keySerializator, valueSerializator));
 }
Exemplo n.º 4
0
 protected DictionaryMapperBase(
     IJsonSerializator <TKey> keySerializator, IJsonSerializator <TValue> valueSerializator,
     char startLiteral, char endLiteral, JsonToken startToken, JsonToken emptyToken, JsonToken endToken)
 {
     _keyMapper    = keySerializator.Mapper;
     _valueMapper  = valueSerializator.Mapper;
     _startLiteral = startLiteral;
     _emptyToken   = emptyToken;
     _endLiteral   = endLiteral;
     _startToken   = startToken;
     _endToken     = endToken;
 }
Exemplo n.º 5
0
 public bool TryGetSerializator <T>(out IJsonSerializator <T> serializator)
 {
     try
     {
         serializator = GetSerializator <T>();
         return(true);
     }
     catch (JsonException)
     {
         serializator = null;
         return(false);
     }
 }
Exemplo n.º 6
0
 private IJsonMapper <T> Build <T>(Type type, Type delegatingType, IJsonSerializator jsonSerializator)
 {
     try
     {
         Type[]     methodTypes = GetMethodTypes(type, delegatingType);
         MethodInfo generic     = _buildReflectionInvoke.MakeGenericMethod(methodTypes);
         object     result      = generic.Invoke(this, new object[] { jsonSerializator });
         return((IJsonMapper <T>)result);
     }
     catch (Exception exc)
     {
         return(ExceptionHelper.ThrowUnexpectedException <IJsonMapper <T> >(exc));
     }
 }
Exemplo n.º 7
0
 private IJsonSerializator[] GetJsonSerializators(IJsonContext context, Type[] types)
 {
     IJsonSerializator[] result = new IJsonSerializator[types.Length];
     for (int i = 0; i < types.Length; i++)
     {
         IJsonSerializator tmp = context.GetSerializatorReflection(types[i]);
         if (tmp == null)
         {
             return(null);
         }
         result[i] = tmp;
     }
     return(result);
 }
Exemplo n.º 8
0
 public NullableJsonMapper(IJsonSerializator <T> serializator)
 {
     _mapper = serializator.Mapper;
 }
Exemplo n.º 9
0
 private IJsonMapper <T?> BuildReflectionInvoke <T>(IJsonSerializator <T> serializator) where T : struct
 {
     return(new NullableJsonMapper <T>(serializator));
 }
Exemplo n.º 10
0
 public ArrayMapper(IJsonSerializator <List <T> > serializator)
 {
     _mapper = serializator.Mapper;
 }
Exemplo n.º 11
0
 private IJsonMapper <T[]> BuildReflectionInvoke <T>(IJsonSerializator <List <T> > serializator)
 {
     return(new ArrayMapper <T>(serializator));
 }
Exemplo n.º 12
0
 public ListMapper(IJsonSerializator <TItem> serializator)
 {
     _mapper = serializator.Mapper;
 }
Exemplo n.º 13
0
 private IJsonMapper <ObservableCollection <T> > BuildReflectionInvoke <T>(IJsonSerializator <T> serializator)
 {
     return(new ListMapper <ObservableCollection <T>, ObservableCollection <T>, T>(serializator));
 }
Exemplo n.º 14
0
 private IJsonMapper <List <T> > BuildReflectionInvoke <T>(IJsonSerializator <T> serializator)
 {
     return(new ListMapper <List <T>, List <T>, T>(serializator));
 }
Exemplo n.º 15
0
 private IJsonMapper <SortedSet <T> > BuildReflectionInvoke <T>(IJsonSerializator <T> serializator)
 {
     return(new SetMapper <SortedSet <T>, SortedSet <T>, T>(serializator));
 }