Exemple #1
0
 private bool CheckAllGenericParameters(IJsonContext context, Type[] types)
 {
     foreach (var type in types)
     {
         if (context.GetSerializatorReflection(type) == null)
         {
             return(false);
         }
     }
     return(true);
 }
Exemple #2
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);
 }
Exemple #3
0
        public bool CanBuild <T>(IJsonContext context)
        {
            var type = typeof(T);

            if (!IsRequestedTypeSupported(type))
            {
                return(false);
            }
            var delegatingType = GenerateDelegatingType(type);

            if (delegatingType == null)
            {
                return(false);
            }
            return(context.GetSerializatorReflection(delegatingType) != null);
        }
Exemple #4
0
        public IJsonMapper <T> Build <T>(IJsonContext context)
        {
            var type = typeof(T);

            if (!IsRequestedTypeSupported(type))
            {
                return(null);
            }
            var delegatingType = GenerateDelegatingType(type);

            if (delegatingType == null)
            {
                return(null);
            }
            var serializator = context.GetSerializatorReflection(delegatingType);

            if (serializator == null)
            {
                return(null);
            }
            return(Build <T>(type, delegatingType, serializator));
        }