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