コード例 #1
0
ファイル: ConcurrentCache.cs プロジェクト: ysj1995/Trinity
 public ConcurrentCache(SourceProducer sourceProducer, KeyProducer keyProducer, UpdateFactory updateFactory, CreateFactory createFactory, RemovedAction removedAction = null)
 {
     _sourceFactory = sourceProducer;
     _updateFactory = updateFactory;
     _createFactory = createFactory;
     _keyProducer   = keyProducer;
     _removedAction = removedAction;
 }
コード例 #2
0
 public static List <Parameter> getParameters(List <ParameterInfo> parameters)
 {
     return(parameters.Select(p =>
     {
         IKey key = KeyProducer.getParameterKey(p);
         return new Parameter(p, key);
     }).ToList());
 }
コード例 #3
0
        public static List <MethodInfoObject> extractProducers(object obj)
        {
            var methods = obj.GetType().GetMethods(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance).Where(m =>
            {
                var alist    = m.GetCustomAttributes(false).ToList();
                var filtered = alist.Where(a => a.GetType() == typeof(Produce)).ToList();
                return(filtered.Count() > 0);
            }).Select(methodInfo => new MethodInfoObject(obj, methodInfo, KeyProducer.getProduceKey(methodInfo))).ToList();

            return(methods);
        }
コード例 #4
0
        protected void extractInsertKeys(object o)
        {
            var keys = KeyProducer.getInsertKeys(o);

            if (keys.Count() > 0)
            {
                keys.ForEach(key =>
                {
                    addFinalObject(key.getCode(), new FinalValue(key, o), true);
                });
            }
            else
            {
                toBeInjected.Add(o);
            }
        }
コード例 #5
0
        public static List <Property> getPropertiesToInject(object o)
        {
            var members = getPropertiesAnnotatedWith(o.GetType(), typeof(Inject)).Select(f => new Property(f, KeyProducer.produceKey(f))).ToList();

            return(members);
        }
コード例 #6
0
        public static List <Field> getFieldsToInject(object o)
        {
            var members = getFieldsAnnotatedWith(o.GetType(), typeof(Inject)).Select(p => new Field(p, KeyProducer.produceKey(p))).ToList();

            return(members);
        }