Пример #1
0
 public AnnotatedType(Type type, IAnnotations annotations)
 {
     Type              = type;
     Annotations       = annotations;
     _fieldsLazy       = new Lazy <IEnumerable <IAnnotatedField> >(GetFields);
     _methodsLazy      = new Lazy <IEnumerable <IAnnotatedMethod> >(GetMethods);
     _propertiesLazy   = new Lazy <IEnumerable <IAnnotatedProperty> >(GetProperties);
     _constructorsLazy = new Lazy <IEnumerable <IAnnotatedConstructor> >(GetConstructors);
 }
Пример #2
0
 public EventObserverMethod(IWeldComponent component, ParameterInfo parameter, IAnnotations annotations)
 {
     Component    = component;
     _parameter   = parameter;
     _annotations = annotations;
     _eventType   = parameter.ParameterType;
     IsConcrete   = _eventType.ContainsGenericParameters;
     _method      = new InjectableMethod(component, (MethodInfo)parameter.Member, parameter);
     NextNonLinearValidatables = _method.LinearValidatables.Union(_method.NonLinearValidatables);
 }
Пример #3
0
 protected AbstractInjectionPoint(IComponent declaringComponent, MemberInfo member, Type type, IAnnotations annotations)
 {
     DeclaringComponent = declaringComponent;
     Member             = member;
     ComponentType      = type;
     Annotations        = annotations;
     IsCacheable        = IsCacheableType(type);
     Unwraps            = annotations.OfType <UnwrapAttribute>().Any();
     _lazyComponents    = new Lazy <IComponent>(ResolveComponents);
     _lazyInjectPlan    = new Lazy <InjectPlan>(() => BuildInjectPlan(Component));
     _lazyGetValuePlan  = new Lazy <BuildPlan>(BuildGetValuePlan);
 }
Пример #4
0
        private AbstractComponent(Type type, IAnnotations annotations, WeldComponentManager manager)
        {
            Annotations = annotations;
            var qualifierSet = new HashSet <IQualifier>(Annotations.OfType <IQualifier>());

            if (qualifierSet.All(x => (x is AnyAttribute)))
            {
                qualifierSet.Add(DefaultAttribute.Instance);
            }

            Type                   = type;
            Manager                = manager;
            Scope                  = annotations.OfType <ScopeAttribute>().Select(x => x.GetType()).FirstOrDefault() ?? typeof(DependentAttribute);
            IsProxyRequired        = typeof(NormalScopeAttribute).IsAssignableFrom(Scope) && !Annotations.OfType <UnwrapAttribute>().Any();
            _lazyBuildPlan         = new Lazy <BuildPlan>(GetBuildPlan);
            IsConditionalOnMissing = Annotations.OfType <ConditionalOnMissingComponentAttribute>().Any();
        }
Пример #5
0
 protected AbstractProducer(IWeldComponent declaringComponent, MemberInfo member, Type returnType, IAnnotations annotations, WeldComponentManager manager)
     : base(Formatters.Member(member), returnType, annotations, manager)
 {
     _containsGenericParameters = GenericUtils.MemberContainsGenericArguments(member);
     DeclaringComponent         = declaringComponent;
 }
Пример #6
0
 private FieldInjectionPoint(IComponent declaringComponent, FieldInfo field, IAnnotations annotations) :
     base(declaringComponent, field, field.FieldType, annotations)
 {
     _field = field;
 }
Пример #7
0
 public ProducerProperty(IWeldComponent component, PropertyInfo property, IAnnotations annotations, WeldComponentManager manager)
     : base(component, property, property.PropertyType, annotations, manager)
 {
     _property = property;
 }
Пример #8
0
 private ProducerField(IWeldComponent component, FieldInfo field, IAnnotations annotations, WeldComponentManager manager)
     : base(component, field, field.FieldType, annotations, manager)
 {
     _field = field;
 }
Пример #9
0
 public InstanceComponent(Type baseType, IAnnotations annotations, WeldComponentManager manager, IWeldComponent[] components)
     : base("", typeof(Instance <>).MakeGenericType(baseType), annotations, manager)
 {
     _baseType   = baseType;
     _components = components;
 }
Пример #10
0
 protected AbstractComponent(string idSuffix, Type type, IAnnotations annotations, WeldComponentManager manager)
     : this(type, annotations, manager)
 {
     _id = new ComponentIdentifier(string.Format("{0}-{1}-{2}", manager.Id, GetType().Name, idSuffix));
 }
Пример #11
0
 protected AbstractComponent(ComponentIdentifier id, Type type, IAnnotations annotations, WeldComponentManager manager)
     : this(type, annotations, manager)
 {
     _id = id;
 }
Пример #12
0
 public void SetAnnotations(IAnnotations annotations)
 {
     AnnotatedType = new AnnotatedType(AnnotatedType.Type, annotations);
 }
Пример #13
0
 private PropertyInjectionPoint(IComponent declaringComponent, PropertyInfo property, IAnnotations annotations) :
     base(declaringComponent, property, property.PropertyType, annotations)
 {
     _property = property;
 }
 public MethodParameterInjectionPoint(IComponent declaringComponent, ParameterInfo paramInfo, IAnnotations annotations)
     : base(declaringComponent, paramInfo.Member, paramInfo.ParameterType, annotations)
 {
     _param        = paramInfo;
     IsConstructor = _param.Member is ConstructorInfo;
 }
Пример #15
0
 public ProducerMethod(IWeldComponent declaringComponent, MethodInfo method, IAnnotations annotations, WeldComponentManager manager)
     : base(declaringComponent, method, method.ReturnType, annotations, manager)
 {
     _method = new InjectableMethod(declaringComponent, method, null);
 }