public static IMethodLevelBehavior <T> Create <A>(Type beanType, AnnotationCache <A> annotationCache, Type behaviourType, IBehaviorTypeExtractor <A, T> behaviourTypeExtractor, IBeanContextFactory beanContextFactory, IServiceContext beanContext) where A : Attribute { BehaviorKey key = new BehaviorKey(beanType, behaviourType); IMethodLevelBehavior <T> behavior = (IMethodLevelBehavior <T>)beanTypeToBehavior.Get(key); if (behavior != null) { if (behavior == noBehavior) { return(null); } return(behavior); } A annotation = annotationCache.GetAnnotation(beanType); if (annotation == null) { beanTypeToBehavior.Put(key, noBehavior); return(null); } T defaultBehaviour = behaviourTypeExtractor.ExtractBehaviorType(annotation); MethodLevelHashMap <T> methodLevelBehaviour = null; MethodInfo[] methods = ReflectUtil.GetMethods(beanType); for (int a = methods.Length; a-- > 0;) { MethodInfo method = methods[a]; A annotationOnMethod = annotationCache.GetAnnotation(method); if (annotationOnMethod != null) { if (methodLevelBehaviour == null) { methodLevelBehaviour = new MethodLevelHashMap <T>(); } T behaviourTypeOnMethod = behaviourTypeExtractor.ExtractBehaviorType(annotationOnMethod); if (behaviourTypeOnMethod != null) { methodLevelBehaviour.Put(method, behaviourTypeOnMethod); } } } if (methodLevelBehaviour == null) { methodLevelBehaviour = new MethodLevelHashMap <T>(0); } behavior = new MethodLevelBehavior <T>(defaultBehaviour, methodLevelBehaviour); beanTypeToBehavior.Put(key, behavior); return(behavior); }