示例#1
0
 protected void FillMethodsAnnotatedWith(Type type, IList <MethodInfo> methods, params Type[] annotations)
 {
     if (type == null || typeof(Object).Equals(type))
     {
         return;
     }
     FillMethodsAnnotatedWith(type.BaseType, methods, annotations);
     MethodInfo[] allMethodsOfThisType = type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic);
     for (int a = 0, size = allMethodsOfThisType.Length; a < size; a++)
     {
         MethodInfo currentMethod = allMethodsOfThisType[a];
         for (int b = annotations.Length; b-- > 0;)
         {
             if (AnnotationUtil.GetAnnotation(annotations[b], currentMethod, false) == null)
             {
                 continue;
             }
             if (currentMethod.GetParameters().Length != 0)
             {
                 throw new Exception("It is not allowed to annotated methods without " + annotations[b].FullName + " having 0 arguments: "
                                     + currentMethod.ToString());
             }
             methods.Add(currentMethod);
         }
     }
 }
示例#2
0
 protected Object Intercept(IInvocation invocation, String methodName, Attribute annotation, Boolean?isAsyncBegin)
 {
     if (AnnotationUtil.GetAnnotation <ProcessAttribute>(invocation.Method, false) != null)
     {
         return(InterceptApplication(invocation, annotation, isAsyncBegin));
     }
     if (AnnotationUtil.GetAnnotation <MergeAttribute>(invocation.Method, false) != null ||
         methodName.StartsWith("update") ||
         methodName.StartsWith("save") ||
         methodName.StartsWith("merge") ||
         methodName.StartsWith("insert"))
     {
         return(InterceptMerge(invocation, annotation, isAsyncBegin));
     }
     if (AnnotationUtil.GetAnnotation <RemoveAttribute>(invocation.Method, false) != null ||
         methodName.StartsWith("delete") ||
         methodName.StartsWith("remove"))
     {
         return(InterceptDelete(invocation, annotation, isAsyncBegin));
     }
     if (AnnotationUtil.GetAnnotation <FindAttribute>(invocation.Method, false) != null ||
         methodName.StartsWith("retrieve") ||
         methodName.StartsWith("read") ||
         methodName.StartsWith("find") ||
         methodName.StartsWith("get"))
     {
         return(InterceptLoad(invocation, annotation, isAsyncBegin));
     }
     if (methodName.Equals("close") || methodName.Equals("abort"))
     {
         // Intended blank
     }
     return(InterceptApplication(invocation, annotation, isAsyncBegin));
 }
示例#3
0
        protected void FindAnnotations <V>(Type type, IList <IAnnotationInfo <V> > targetList, bool isFirst) where V : Attribute
        {
            if (type == null || typeof(Object).Equals(type))
            {
                return;
            }
            if (!type.IsInterface)
            {
                FindAnnotations <V>(type.BaseType, targetList, false);
            }
            IList <V> annotations = AnnotationUtil.GetAnnotations <V>(type, false);

            for (int a = 0, size = annotations.Count; a < size; a++)
            {
                targetList.Add(new AnnotationInfo <V>(annotations[a], type));
            }
            //if (isFirst)
            //{
            //    Type[] interfaces = type.GetInterfaces();
            //    foreach (Type currInterface in interfaces)
            //    {
            //        IList<V> annotationsOfInterface = AnnotationUtil.GetAnnotations<V>(currInterface, true);
            //        for (int a = 0, size = annotationsOfInterface.Count; a < size; a++)
            //        {
            //            targetList.Add(new AnnotationInfo<V>(annotationsOfInterface[a], type));
            //        }
            //    }
            //}
        }
        private static EventType ValidateExpressionGetEventType(string msgprefix, IList <AnnotationDesc> annotations, EventAdapterService eventAdapterService)

        {
            IDictionary <String, IList <AnnotationDesc> > annos = AnnotationUtil.MapByNameLowerCase(annotations);

            // check annotations used
            IList <AnnotationDesc> typeAnnos = annos.Pluck("type");

            if (!annos.IsEmpty())
            {
                throw new ExprValidationException(msgprefix + " unrecognized annotation '" + annos.Keys.First() + "'");
            }

            // type determination
            EventType optionalType = null;

            if (typeAnnos != null)
            {
                string typeName = AnnotationUtil.GetExpectSingleStringValue(msgprefix, typeAnnos);
                optionalType = eventAdapterService.GetEventTypeByName(typeName);
                if (optionalType == null)
                {
                    throw new ExprValidationException(msgprefix + " failed to find event type '" + typeName + "'");
                }
            }

            return(optionalType);
        }
        protected ForkStateEntry[] GetForkStateEntries()
        {
            ForkStateEntry[] cachedForkStateEntries = this.cachedForkStateEntries;
            if (cachedForkStateEntries != null)
            {
                return(cachedForkStateEntries);
            }
            Lock writeLock = listeners.GetWriteLock();

            writeLock.Lock();
            try
            {
                // check again: concurrent thread might have been faster
                cachedForkStateEntries = this.cachedForkStateEntries;
                if (cachedForkStateEntries != null)
                {
                    return(cachedForkStateEntries);
                }
                IThreadLocalCleanupBean[] extensions       = listeners.GetExtensions();
                List <ForkStateEntry>     forkStateEntries = new List <ForkStateEntry>(extensions.Length);
                for (int a = 0, size = extensions.Length; a < size; a++)
                {
                    IThreadLocalCleanupBean extension = extensions[a];
                    FieldInfo[]             fields    = ReflectUtil.GetDeclaredFieldsInHierarchy(extension.GetType());
                    foreach (FieldInfo field in fields)
                    {
                        Forkable forkable = AnnotationUtil.GetAnnotation <Forkable>(field, false);
                        if (forkable == null)
                        {
                            continue;
                        }
                        Object valueTL = field.GetValue(extension);
                        if (valueTL == null)
                        {
                            continue;
                        }
                        Type           forkProcessorType = forkable.Processor;
                        IForkProcessor forkProcessor     = null;
                        if (forkProcessorType != null && !typeof(IForkProcessor).Equals(forkProcessorType))
                        {
                            WeakReference   beanContextOfExtensionR = extensionToContextMap.Get(extension);
                            IServiceContext beanContextOfExtension  = beanContextOfExtensionR != null ? (IServiceContext)beanContextOfExtensionR.Target : null;
                            if (beanContextOfExtension == null)
                            {
                                beanContextOfExtension = BeanContext;
                            }
                            forkProcessor = beanContextOfExtension.RegisterBean <IForkProcessor>(forkProcessorType).Finish();
                        }
                        forkStateEntries.Add(new ForkStateEntry(extension, field.Name, valueTL, forkable.Value, forkProcessor));
                    }
                }
                cachedForkStateEntries      = forkStateEntries.ToArray();
                this.cachedForkStateEntries = cachedForkStateEntries;
                return(cachedForkStateEntries);
            }
            finally
            {
                writeLock.Unlock();
            }
        }
示例#6
0
        private static EventType ValidateExpressionGetEventType(
            string msgprefix,
            IList<AnnotationDesc> annotations,
            StatementCompileTimeServices services)
        {
            var annos = AnnotationUtil.MapByNameLowerCase(annotations);

            // check annotations used
            var typeAnnos = annos.Delete("type");
            if (!annos.IsEmpty()) {
                throw new ExprValidationException(msgprefix + " unrecognized annotation '" + annos.Keys.First() + "'");
            }

            // type determination
            EventType optionalType = null;
            if (typeAnnos != null) {
                var typeName = AnnotationUtil.GetExpectSingleStringValue(msgprefix, typeAnnos);
                optionalType = services.EventTypeCompileTimeResolver.GetTypeByName(typeName);
                if (optionalType == null) {
                    throw new ExprValidationException(msgprefix + " failed to find event type '" + typeName + "'");
                }
            }

            return optionalType;
        }
示例#7
0
        public String GetPropertyNameFor(MethodInfo method)
        {
            PropertyAccessor propertyAccessor = AnnotationUtil.GetAnnotation <PropertyAccessor>(method, true);

            if (propertyAccessor != null)
            {
                return(propertyAccessor.PropertyName);
            }
            Match matcher = getSetIsPattern.Match(method.Name);

            if (!matcher.Success)
            {
                return("");
            }
            int    paramLength = method.GetParameters().Length;
            String getSetIs    = matcher.Groups[1].Value;

            if (("get_".Equals(getSetIs) || "Get".Equals(getSetIs) || "get".Equals(getSetIs)) && (0 != paramLength || typeof(void).Equals(method.ReturnType)))
            {
                return("");
            }
            else if (("set_".Equals(getSetIs) || "Set".Equals(getSetIs) || "set".Equals(getSetIs)) && 1 != paramLength)
            {
                return("");
            }
            else if (("Is".Equals(getSetIs) || "is".Equals(getSetIs)) && (0 != paramLength || typeof(void).Equals(method.ReturnType)))
            {
                return("");
            }
            String name = matcher.Groups[2].Value;

            return(StringConversionHelper.UpperCaseFirst(name));
        }
示例#8
0
        protected override Attribute LookForAnnotation(MemberInfo method)
        {
            Attribute annotation = base.LookForAnnotation(method);

            if (annotation != null)
            {
                return(annotation);
            }
            NoProxyAttribute noProxy = AnnotationUtil.GetAnnotation <NoProxyAttribute>(method, false);

            if (noProxy != null)
            {
                return(noProxy);
            }
            ProcessAttribute process = AnnotationUtil.GetAnnotation <ProcessAttribute>(method, false);

            if (process != null)
            {
                return(process);
            }
            FindAttribute find = AnnotationUtil.GetAnnotation <FindAttribute>(method, false);

            if (find != null)
            {
                return(find);
            }
            MergeAttribute merge = AnnotationUtil.GetAnnotation <MergeAttribute>(method, false);

            if (merge != null)
            {
                return(merge);
            }
            return(AnnotationUtil.GetAnnotation <RemoveAttribute>(method, false));
        }
示例#9
0
        protected override Attribute LookForAnnotation(MemberInfo method)
        {
            Attribute annotation = base.LookForAnnotation(method);

            if (annotation != null)
            {
                return(annotation);
            }
            return(AnnotationUtil.GetAnnotation <CachedAttribute>(method, false));
        }
示例#10
0
 public void MakeMethod(
     CodegenMethod method,
     SAIFFInitializeSymbol symbols,
     CodegenClassScope classScope)
 {
     var select = Ref("select");
     method.Block
         .DeclareVar<FAFQueryMethodSelect>(select.Ref, NewInstance(typeof(FAFQueryMethodSelect)))
         .SetProperty(
             select,
             "Annotations",
             LocalMethod(
                 AnnotationUtil.MakeAnnotations(typeof(Attribute[]), _desc.Annotations, method, classScope)))
         .SetProperty(
             select,
             "Processors",
             FireAndForgetProcessorForgeExtensions.MakeArray(_desc.Processors, method, symbols, classScope))
         .DeclareVar(
             _classNameResultSetProcessor,
             "rsp",
             NewInstance(_classNameResultSetProcessor, symbols.GetAddInitSvc(method), Ref("statementFields")))
         .SetProperty(select, "ResultSetProcessorFactoryProvider", Ref("rsp"))
         .SetProperty(select, "QueryGraph", _desc.QueryGraph.Make(method, symbols, classScope))
         .SetProperty(
             select,
             "WhereClause",
             _desc.WhereClause == null
                 ? ConstantNull()
                 : ExprNodeUtilityCodegen.CodegenEvaluator(
                     _desc.WhereClause.Forge,
                     method,
                     GetType(),
                     classScope))
         .SetProperty(
             select,
             "JoinSetComposerPrototype",
             _desc.Joins == null ? ConstantNull() : _desc.Joins.Make(method, symbols, classScope))
         .SetProperty(
             select,
             "ConsumerFilters",
             ExprNodeUtilityCodegen.CodegenEvaluators(_desc.ConsumerFilters, method, GetType(), classScope))
         .SetProperty(select, "ContextName", Constant(_desc.ContextName))
         .SetProperty(
             select,
             "TableAccesses",
             ExprTableEvalStrategyUtil.CodegenInitMap(
                 _desc.TableAccessForges,
                 GetType(),
                 method,
                 symbols,
                 classScope))
         .SetProperty(select, "HasTableAccess", Constant(_desc.HasTableAccess))
         .SetProperty(select, "IsDistinct", Constant(_desc.IsDistinct))
         .MethodReturn(select);
 }
示例#11
0
 public static void HandleTypesFromCurrentDomainWithAnnotation <T>(TypeHandleDelegate typeHandleDelegate) where T : Attribute
 {
     foreach (Type type in typesFromCurrentDomain)
     {
         if (!AnnotationUtil.IsAnnotationPresent <T>(type, true))
         {
             continue;
         }
         typeHandleDelegate(type);
     }
 }
示例#12
0
 public virtual bool IsEntityType(Type type)
 {
     if (type == null || type.IsPrimitive || type.IsEnum || primitiveTypes.Contains(type) || noEntityTypeExtendables.GetExtension(type))
     {
         return(false);
     }
     if (AnnotationUtil.IsAnnotationPresent <Embeddable>(type, false) || typeof(IImmutableType).IsAssignableFrom(type))
     {
         return(false);
     }
     return(true);
 }
示例#13
0
 protected bool IsAnnotationPresentIntern <V>(Type type) where V : Attribute
 {
     if (type == null)
     {
         return(false);
     }
     if (AnnotationUtil.IsAnnotationPresent <V>(type, false))
     {
         return(true);
     }
     return(IsAnnotationPresentIntern <V>(type.BaseType));
 }
示例#14
0
        public static EventUnderlyingType GetRepresentation(
            Attribute[] annotations,
            Configuration configs,
            AssignedType assignedType)
        {
            switch (assignedType) {
                // assigned type has priority
                case AssignedType.OBJECTARRAY:
                    return EventUnderlyingType.OBJECTARRAY;

                case AssignedType.MAP:
                    return EventUnderlyingType.MAP;

                case AssignedType.AVRO:
                    return EventUnderlyingType.AVRO;

                case AssignedType.JSON:
                    return EventUnderlyingType.JSON;
            }

            if (assignedType == AssignedType.VARIANT ||
                     assignedType != AssignedType.NONE) {
                throw new IllegalStateException("Not handled by event representation: " + assignedType);
            }

            // annotation has second priority
            var annotation = AnnotationUtil.FindAnnotation(annotations, typeof(EventRepresentationAttribute));
            if (annotation != null) {
                var eventRepresentation = (EventRepresentationAttribute) annotation;
                return eventRepresentation.Value switch {
                    EventUnderlyingType.AVRO => EventUnderlyingType.AVRO,
                    EventUnderlyingType.JSON => EventUnderlyingType.JSON,
                    EventUnderlyingType.OBJECTARRAY => EventUnderlyingType.OBJECTARRAY,
                    EventUnderlyingType.MAP => EventUnderlyingType.MAP,
                    _ => throw new IllegalStateException("Unrecognized enum " + eventRepresentation.Value)
                };
            }

            // use runtime-wide default
            var configured = configs.Common.EventMeta.DefaultEventRepresentation;
            return configured switch {
                EventUnderlyingType.OBJECTARRAY => EventUnderlyingType.OBJECTARRAY,
                EventUnderlyingType.MAP => EventUnderlyingType.MAP,
                EventUnderlyingType.AVRO => EventUnderlyingType.AVRO,
                EventUnderlyingType.JSON => EventUnderlyingType.JSON,
                _ => EventUnderlyingType.MAP
            };
        }
    }
} // end of namespace
示例#15
0
        public IReaderWriterLock GetStatementLock(String statementName, Attribute[] annotations, bool stateless)
        {
            bool foundNoLock = AnnotationUtil.FindAttribute(annotations, typeof(NoLockAttribute)) != null;

            if (_disableLocking || foundNoLock || stateless)
            {
                return(ReaderWriterLockManager.VoidLock());
            }

            if (_fairlocks)
            {
                return(ReaderWriterLockManager.FairLock());
            }

            return(ReaderWriterLockManager.CreateDefaultLock());
        }
示例#16
0
        protected IList <IAnnotationInfo <V> > FindAnnotations <V>(Type type, MethodInfo method) where V : Attribute
        {
            IList <IAnnotationInfo <V> > targetList = new List <IAnnotationInfo <V> >();

            FindAnnotations <V>(type, targetList, true);

            if (method != null)
            {
                IList <V> annotations = AnnotationUtil.GetAnnotations <V>(method, true);
                for (int a = 0, size = annotations.Count; a < size; a++)
                {
                    targetList.Add(new AnnotationInfo <V>(annotations[a], method));
                }
            }
            return(targetList);
        }
        public EventTypeBusModifier GetBusModifierEventType(
            StatementRawInfo raw,
            string eventTypeName)
        {
            if (options.BusModifierEventType != null) {
                var result = options.BusModifierEventType.Invoke(new BusModifierEventTypeContext(raw, eventTypeName));
                if (result != null) {
                    return result.Value;
                }
            }

            var busEventType = AnnotationUtil.HasAnnotation(raw.Annotations, typeof(BusEventTypeAttribute));
            if (busEventType) {
                return EventTypeBusModifier.BUS;
            }

            return config.BusModifierEventType;
        }
        private NameAccessModifier GetModifier(
            Attribute[] annotations,
            Func<CompilerOptions, NameAccessModifier?> optionsGet,
            Func<ConfigurationCompilerByteCode, NameAccessModifier> configGet)
        {
            if (options != null) {
                var result = optionsGet.Invoke(options);
                if (result != null) {
                    return result.Value;
                }
            }

            var isPrivate = AnnotationUtil.HasAnnotation(annotations, typeof(PrivateAttribute));
            var isProtected = AnnotationUtil.HasAnnotation(annotations, typeof(ProtectedAttribute));
            var isPublic = AnnotationUtil.HasAnnotation(annotations, typeof(PublicAttribute));
            if (isPrivate) {
                if (isProtected) {
                    throw new EPException("Encountered both the @private and the @protected annotation");
                }

                if (isPublic) {
                    throw new EPException("Encountered both the @private and the @public annotation");
                }
            }
            else if (isProtected && isPublic) {
                throw new EPException("Encountered both the @protected and the @public annotation");
            }

            if (isPrivate) {
                return NameAccessModifier.PRIVATE;
            }

            if (isProtected) {
                return NameAccessModifier.INTERNAL;
            }

            if (isPublic) {
                return NameAccessModifier.PUBLIC;
            }

            return configGet.Invoke(config);
        }
示例#19
0
        public void SearchAnnoationTest_NoResult()
        {
            string    keywords = "ABCDEFGHIJKLMNOOPQRSTUVWXYZ";
            Stopwatch time     = new Stopwatch();

            time.Start();
            var result0 = AnnotationUtil.SearchAnnotation(keywords);

            Assert.AreEqual(0, result0.Count);
            var result1 = AnnotationUtil.SearchAnnotation(keywords, AnnotationType.Highlight);

            Assert.AreEqual(0, result1.Count);
            var result2 = AnnotationUtil.SearchAnnotation(keywords, AnnotationType.StickyNote);

            Assert.AreEqual(0, result2.Count);
            var result3 = AnnotationUtil.SearchAnnotation(keywords, AnnotationType.Orphan);

            Assert.AreEqual(0, result3.Count);
            var tempText = keywords;
        }
示例#20
0
        public void SearchAnnoationTest_Regular()
        {
            string    keywords = "A1";
            Stopwatch time     = new Stopwatch();

            time.Start();
            var result0 = AnnotationUtil.SearchAnnotation(keywords);

            Assert.LessOrEqual(0, result0.Count);
            var result1 = AnnotationUtil.SearchAnnotation(keywords, AnnotationType.Highlight);

            Assert.LessOrEqual(0, result1.Count);
            var result2 = AnnotationUtil.SearchAnnotation(keywords, AnnotationType.StickyNote);

            Assert.LessOrEqual(0, result2.Count);
            var result3 = AnnotationUtil.SearchAnnotation(keywords, AnnotationType.Orphan);

            Assert.LessOrEqual(0, result3.Count);
            var tempText = keywords;
        }
示例#21
0
        protected override Object InterceptApplication(IInvocation invocation, Attribute annotation, Boolean?isAsyncBegin)
        {
            bool oldProcessServiceActive = processServiceActiveTL.Value;

            if (oldProcessServiceActive || ProcessService == null || !AnnotationUtil.IsAnnotationPresent <ServiceClientAttribute>(invocation.Method.DeclaringType, false))
            {
                return(base.InterceptApplication(invocation, annotation, isAsyncBegin));
            }
            ISecurityScope[]    securityScopes     = SecurityScopeProvider.SecurityScopes;
            IServiceDescription serviceDescription = SyncToAsyncUtil.CreateServiceDescription(ServiceName, invocation.Method, invocation.Arguments, securityScopes);

            processServiceActiveTL.Value = true;
            try
            {
                return(ProcessService.InvokeService(serviceDescription));
            }
            finally
            {
                processServiceActiveTL.Value = oldProcessServiceActive;
            }
        }
示例#22
0
        public IReaderWriterLock GetStatementLock(
            string statementName,
            Attribute[] annotations,
            bool stateless,
            StatementType statementType)
        {
            if (statementType.IsOnTriggerInfra()) {
                throw new UnsupportedOperationException("Operation not available for statement type " + statementType);
            }

            bool foundNoLock = AnnotationUtil.FindAnnotation(annotations, typeof(NoLockAttribute)) != null;
            if (disableLocking || foundNoLock || stateless) {
                return new VoidReaderWriterLock();
                //return new StatementAgentInstanceLockNoLockImpl(statementName);
            } else if (fairlocks) {
                return new FairReaderWriterLock();
            }
            else {
                return new SlimReaderWriterLock();
            }
        }
示例#23
0
        protected override Statement MethodBlock(MethodInfo method)
        {
            Statement statement = base.MethodBlock(method);

            return(new Statement(delegate()
            {
                if (!hasContextBeenRebuildForThisTest)
                {
                    if (method == null || !AnnotationUtil.IsAnnotationPresent <IgnoreAttribute>(method, false))
                    {
                        IList <IAnnotationInfo <TestRebuildContext> > rebuildContextList = FindAnnotations <TestRebuildContext>(testClass);
                        if (rebuildContextList.Count > 0)
                        {
                            bool rebuildContext = ((TestRebuildContext)rebuildContextList[rebuildContextList.Count - 1].Annotation).Value;
                            if (rebuildContext)
                            {
                                RebuildContext(method);
                                hasContextBeenRebuildForThisTest = true;
                                isRebuildContextForThisTestRecommended = false;
                            }
                        }
                        if (method != null)
                        {
                            if (AnnotationUtil.IsAnnotationPresent <TestModule>(method, false) || AnnotationUtil.IsAnnotationPresent <TestFrameworkModule>(method, false) ||
                                AnnotationUtil.IsAnnotationPresent <TestProperties>(method, false))
                            {
                                RebuildContext(method);
                                hasContextBeenRebuildForThisTest = true;
                                isRebuildContextForThisTestRecommended = false;
                            }
                        }
                    }
                }
                if (beanContext == null || isRebuildContextForThisTestRecommended)
                {
                    RebuildContext(method);
                }
                statement();
            }));
        }
示例#24
0
        protected Type[] GetModules(bool scanForFrameworkModule)
        {
            if (log.InfoEnabled)
            {
                log.Info("Looking for " + (scanForFrameworkModule ? "Ambeth" : "Application") + " bootstrap modules in classpath...");
            }
            IList <Type> bootstrapOrFrameworkModules = ClasspathScanner.ScanClassesAnnotatedWith(scanForFrameworkModule ? typeof(FrameworkModuleAttribute)
                                    : typeof(BootstrapModuleAttribute));

            List <Type> bootstrapModules = new List <Type>(bootstrapOrFrameworkModules.Count);

            foreach (Type bootstrapOrFrameworkModule in bootstrapOrFrameworkModules)
            {
                if (scanForFrameworkModule && AnnotationUtil.IsAnnotationPresent <FrameworkModuleAttribute>(bootstrapOrFrameworkModule, false))
                {
                    bootstrapModules.Add(bootstrapOrFrameworkModule);
                }
                else if (AnnotationUtil.IsAnnotationPresent <BootstrapModuleAttribute>(bootstrapOrFrameworkModule, false) &&
                         !AnnotationUtil.IsAnnotationPresent <FrameworkModuleAttribute>(bootstrapOrFrameworkModule, false))
                {
                    bootstrapModules.Add(bootstrapOrFrameworkModule);
                }
            }
            if (log.InfoEnabled)
            {
                log.Info("Found " + bootstrapModules.Count + (scanForFrameworkModule ? " Ambeth" : " Application")
                         + " modules in classpath to include in bootstrap...");
                bootstrapModules.Sort(delegate(Type o1, Type o2)
                {
                    return(o1.FullName.CompareTo(o2.FullName));
                });
                for (int a = 0, size = bootstrapModules.Count; a < size; a++)
                {
                    Type boostrapModule = bootstrapModules[a];
                    log.Info("Including " + boostrapModule.FullName);
                }
            }
            return(bootstrapModules.ToArray());
        }
示例#25
0
        public void PutAnnotations(ICustomAttributeProvider obj)
        {
            if (obj is MethodInfo)
            {
                MethodInfo m          = (MethodInfo)obj;
                Type[]     parameters = new Type[m.GetParameters().Length];
                for (int a = m.GetParameters().Length; a-- > 0;)
                {
                    parameters[a] = m.GetParameters()[a].ParameterType;
                }
                Type       baseType         = m.DeclaringType.BaseType;
                MethodInfo overriddenMethod = baseType != null?ReflectUtil.GetDeclaredMethod(true, baseType, m.ReturnType, m.Name, parameters) : null;

                if (overriddenMethod != null)
                {
                    PutAnnotations(overriddenMethod);
                }
            }
            Object[] annotations = obj.GetCustomAttributes(true);
            foreach (Object anno in annotations)
            {
                Attribute annotation = (Attribute)anno;
                AttributeUsageAttribute attributeUsage = AnnotationUtil.GetAnnotation <AttributeUsageAttribute>(annotation.GetType(), true);
                Type type = annotation.GetType();
                if (this.annotations == null)
                {
                    this.annotations = new LinkedHashMap <Type, Attribute[]>();
                }
                Attribute[] existingAttributes = this.annotations.Get(type);
                if (existingAttributes == null)
                {
                    existingAttributes = new Attribute[0];
                }
                Attribute[] newAttributes = new Attribute[existingAttributes.Length + 1];
                Array.Copy(existingAttributes, newAttributes, existingAttributes.Length);
                newAttributes[existingAttributes.Length] = annotation;
                this.annotations.Put(type, newAttributes);
            }
        }
        private void RunAssertionBuiltin(EPServiceProvider epService)
        {
            var stmtText = "@Name('MyTestStmt') @Description('MyTestStmt description') @Tag(Name=\"UserId\", Value=\"value\") select * from Bean";
            var stmt     = epService.EPAdministrator.CreateEPL(stmtText);

            Assert.IsTrue(((EPStatementSPI)stmt).IsNameProvided);
            TryAssertion(stmt);
            stmt.Dispose();
            var name = (NameAttribute)AnnotationUtil.FindAnnotation(stmt.Annotations, typeof(NameAttribute));

            Assert.AreEqual("MyTestStmt", name.Value);

            // try lowercase
            var stmtTextLower = "@Name('MyTestStmt') @Description('MyTestStmt description') @Tag(Name=\"UserId\", Value=\"value\") select * from Bean";

            stmt = epService.EPAdministrator.CreateEPL(stmtTextLower);
            TryAssertion(stmt);
            stmt.Dispose();

            // try pattern
            stmtText = "@Name('MyTestStmt') @Description('MyTestStmt description') @Tag(Name='UserId', Value='value') every Bean";
            stmt     = epService.EPAdministrator.CreatePattern(stmtText);
            TryAssertion(stmt);
            stmt.Dispose();

            stmtText = "@" + typeof(NameAttribute).FullName + "('MyTestStmt') @Description('MyTestStmt description') @Tag(Name=\"UserId\", Value=\"value\") every Bean";
            stmt     = epService.EPAdministrator.CreatePattern(stmtText);
            TryAssertion(stmt);

            epService.EPAdministrator.CreateEPL("@Hint('ITERATE_ONLY') select * from Bean");
            epService.EPAdministrator.CreateEPL("@Hint('ITERATE_ONLY,DISABLE_RECLAIM_GROUP') select * from Bean");
            epService.EPAdministrator.CreateEPL("@Hint('ITERATE_ONLY,DISABLE_RECLAIM_GROUP,ITERATE_ONLY') select * from Bean");
            epService.EPAdministrator.CreateEPL("@Hint('  iterate_only ') select * from Bean");

            // test statement name override
            stmtText = "@Name('MyAnnotatedName') select * from Bean";
            stmt     = epService.EPAdministrator.CreateEPL(stmtText, "MyABCStmt");
            Assert.AreEqual("MyABCStmt", stmt.Name);

            // hint tests
            Assert.IsNull(HintEnum.DISABLE_RECLAIM_GROUP.GetHint(null));
            Assert.IsNull(HintEnum.DISABLE_RECLAIM_GROUP.GetHint(new Attribute[0]));

            var annos = epService.EPAdministrator.CreateEPL("@Hint('DISABLE_RECLAIM_GROUP') select * from Bean").Annotations;

            Assert.AreEqual("DISABLE_RECLAIM_GROUP", HintEnum.DISABLE_RECLAIM_GROUP.GetHint(annos).Value);

            annos = epService.EPAdministrator.CreateEPL("@Hint('ITERATE_ONLY,ITERATE_ONLY,DISABLE_RECLAIM_GROUP,ITERATE_ONLY') select * from Bean").Annotations;
            Assert.AreEqual("ITERATE_ONLY,ITERATE_ONLY,DISABLE_RECLAIM_GROUP,ITERATE_ONLY", HintEnum.DISABLE_RECLAIM_GROUP.GetHint(annos).Value);

            annos = epService.EPAdministrator.CreateEPL("@Hint('ITERATE_ONLY,reclaim_group_aged=10') select * from Bean").Annotations;
            var hint = HintEnum.RECLAIM_GROUP_AGED.GetHint(annos);

            Assert.AreEqual("10", HintEnum.RECLAIM_GROUP_AGED.GetHintAssignedValue(hint));

            annos = epService.EPAdministrator.CreateEPL("@Hint('reclaim_group_aged=11') select * from Bean").Annotations;
            hint  = HintEnum.RECLAIM_GROUP_AGED.GetHint(annos);
            Assert.AreEqual("11", HintEnum.RECLAIM_GROUP_AGED.GetHintAssignedValue(hint));

            annos = epService.EPAdministrator.CreateEPL("@Hint('Index(one, two)') select * from Bean").Annotations;
            Assert.AreEqual("one, two", HintEnum.INDEX.GetHintAssignedValues(annos)[0]);

            stmt.Dispose();

            // NoLock
            stmt = epService.EPAdministrator.CreateEPL("@NoLock select * from Bean");
            Assert.IsNotNull(AnnotationUtil.FindAnnotation(stmt.Annotations, typeof(NoLockAttribute)));
            Assert.AreEqual(1, AnnotationUtil.FindAnnotations(stmt.Annotations, typeof(NoLockAttribute)).Count);

            stmt.Dispose();
        }
示例#27
0
        public void TestBuiltin()
        {
            var configuration = SupportConfigFactory.GetConfiguration();

            configuration.AddEventType("Bean", typeof(SupportBean).FullName);
            configuration.AddImport(typeof(MyAnnotationNestableValuesAttribute).Namespace);
            _epService = EPServiceProviderManager.GetDefaultProvider(configuration);
            _epService.Initialize();
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.StartTest(_epService, GetType(), GetType().FullName);
            }

            var stmtText = "@Name('MyTestStmt') @Description('MyTestStmt description') @Tag(Name=\"UserId\", Value=\"Value\") select * from Bean";
            var stmt     = _epService.EPAdministrator.CreateEPL(stmtText);

            Assert.IsTrue((((EPStatementSPI)stmt).IsNameProvided));
            RunAssertion(stmt);
            stmt.Dispose();
            var name = (NameAttribute)AnnotationUtil.FindAnnotation(stmt.Annotations, typeof(NameAttribute));

            Assert.AreEqual("MyTestStmt", name.Value);

            // try lowercase
            var stmtTextLower = "@Name('MyTestStmt') @Description('MyTestStmt description') @Tag(Name=\"UserId\", Value=\"Value\") select * from Bean";

            stmt = _epService.EPAdministrator.CreateEPL(stmtTextLower);
            RunAssertion(stmt);
            stmt.Dispose();

            // try pattern
            stmtText = "@Name('MyTestStmt') @Description('MyTestStmt description') @Tag(Name='UserId', Value='Value') every Bean";
            stmt     = _epService.EPAdministrator.CreatePattern(stmtText);
            RunAssertion(stmt);
            stmt.Dispose();

            stmtText = "@Name('MyTestStmt') @Description('MyTestStmt description') @Tag(Name=\"UserId\", Value=\"Value\") every Bean";
            stmt     = _epService.EPAdministrator.CreatePattern(stmtText);
            RunAssertion(stmt);

            _epService.EPAdministrator.CreateEPL("@Hint('ITERATE_ONLY') select * from Bean");
            _epService.EPAdministrator.CreateEPL("@Hint('ITERATE_ONLY,DISABLE_RECLAIM_GROUP') select * from Bean");
            _epService.EPAdministrator.CreateEPL("@Hint('ITERATE_ONLY,DISABLE_RECLAIM_GROUP,ITERATE_ONLY') select * from Bean");
            _epService.EPAdministrator.CreateEPL("@Hint('  iterate_only ') select * from Bean");

            // test statement name override
            stmtText = "@Name('MyAnnotatedName') select * from Bean";
            stmt     = _epService.EPAdministrator.CreateEPL(stmtText, "MyABCStmt");
            Assert.AreEqual("MyABCStmt", stmt.Name);

            // hint tests
            Assert.IsNull(HintEnum.DISABLE_RECLAIM_GROUP.GetHint(null));
            Assert.IsNull(HintEnum.DISABLE_RECLAIM_GROUP.GetHint(new Attribute[0]));

            var annos =
                _epService.EPAdministrator.CreateEPL("@Hint('DISABLE_RECLAIM_GROUP') select * from Bean").Annotations.ToArray();

            Assert.AreEqual("DISABLE_RECLAIM_GROUP", HintEnum.DISABLE_RECLAIM_GROUP.GetHint(annos).Value);

            annos = _epService.EPAdministrator.CreateEPL("@Hint('ITERATE_ONLY,ITERATE_ONLY,DISABLE_RECLAIM_GROUP,ITERATE_ONLY') select * from Bean").Annotations.ToArray();
            Assert.AreEqual("ITERATE_ONLY,ITERATE_ONLY,DISABLE_RECLAIM_GROUP,ITERATE_ONLY", HintEnum.DISABLE_RECLAIM_GROUP.GetHint(annos).Value);

            annos = _epService.EPAdministrator.CreateEPL("@Hint('ITERATE_ONLY,reclaim_group_aged=10') select * from Bean").Annotations.ToArray();
            var hint = HintEnum.RECLAIM_GROUP_AGED.GetHint(annos);

            Assert.AreEqual("10", HintEnum.RECLAIM_GROUP_AGED.GetHintAssignedValue(hint));

            annos = _epService.EPAdministrator.CreateEPL("@Hint('reclaim_group_aged=11') select * from Bean").Annotations.ToArray();
            hint  = HintEnum.RECLAIM_GROUP_AGED.GetHint(annos);
            Assert.AreEqual("11", HintEnum.RECLAIM_GROUP_AGED.GetHintAssignedValue(hint));

            annos = _epService.EPAdministrator.CreateEPL("@Hint('index(one, two)') select * from Bean").Annotations.ToArray();
            Assert.AreEqual("one, two", HintEnum.INDEX.GetHintAssignedValues(annos)[0]);

            // NoLock
            stmt = _epService.EPAdministrator.CreateEPL("@NoLock select * from Bean");
            Assert.NotNull(AnnotationUtil.FindAnnotation(stmt.Annotations.ToArray(), typeof(NoLockAttribute)));
            Assert.AreEqual(1, AnnotationUtil.FindAttributes(stmt.Annotations.ToArray(), typeof(NoLockAttribute)).Count);

            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.EndTest();
            }
        }
示例#28
0
        public static EventUnderlyingType GetRepresentation(
            Attribute[] annotations,
            ConfigurationInformation configs,
            AssignedType assignedType)
        {
            // assigned type has priority
            if (assignedType == AssignedType.OBJECTARRAY)
            {
                return(EventUnderlyingType.OBJECTARRAY);
            }
            else if (assignedType == AssignedType.MAP)
            {
                return(EventUnderlyingType.MAP);
            }
            else if (assignedType == AssignedType.AVRO)
            {
                return(EventUnderlyingType.AVRO);
            }
            if (assignedType == AssignedType.VARIANT ||
                assignedType != AssignedType.NONE)
            {
                throw new IllegalStateException("Not handled by event representation: " + assignedType);
            }

            // annotation has second priority
            var annotation = AnnotationUtil.FindAnnotation(annotations, typeof(EventRepresentationAttribute));

            if (annotation != null)
            {
                EventRepresentationAttribute eventRepresentation = (EventRepresentationAttribute)annotation;
                if (eventRepresentation.Value == EventUnderlyingType.AVRO)
                {
                    return(EventUnderlyingType.AVRO);
                }
                else if (eventRepresentation.Value == EventUnderlyingType.OBJECTARRAY)
                {
                    return(EventUnderlyingType.OBJECTARRAY);
                }
                else if (eventRepresentation.Value == EventUnderlyingType.MAP)
                {
                    return(EventUnderlyingType.MAP);
                }
                else
                {
                    throw new IllegalStateException("Unrecognized enum " + eventRepresentation.Value);
                }
            }

            // use engine-wide default
            EventUnderlyingType configured = configs.EngineDefaults.EventMeta.DefaultEventRepresentation;

            if (configured == EventUnderlyingType.OBJECTARRAY)
            {
                return(EventUnderlyingType.OBJECTARRAY);
            }
            else if (configured == EventUnderlyingType.MAP)
            {
                return(EventUnderlyingType.MAP);
            }
            else if (configured == EventUnderlyingType.AVRO)
            {
                return(EventUnderlyingType.AVRO);
            }
            return(EventUnderlyingType.MAP);
        }
示例#29
0
        public DataFlowOpInitializeResult Initialize(DataFlowOpInitializateContext context)
        {
            if (context.InputPorts.IsEmpty())
            {
                throw new ArgumentException("Select operator requires at least one input stream");
            }
            if (context.OutputPorts.Count != 1)
            {
                throw new ArgumentException("Select operator requires one output stream but produces " + context.OutputPorts.Count + " streams");
            }

            DataFlowOpOutputPort portZero = context.OutputPorts[0];

            if (portZero.OptionalDeclaredType != null && !portZero.OptionalDeclaredType.IsUnderlying)
            {
                _submitEventBean = true;
            }

            // determine adapter factories for each type
            int numStreams = context.InputPorts.Count;

            _adapterFactories = new EventBeanAdapterFactory[numStreams];
            for (int i = 0; i < numStreams; i++)
            {
                EventType eventType = context.InputPorts.Get(i).TypeDesc.EventType;
                _adapterFactories[i] = context.StatementContext.EventAdapterService.GetAdapterFactoryForType(eventType);
            }

            // Compile and prepare execution
            //
            StatementContext     statementContext     = context.StatementContext;
            EPServicesContext    servicesContext      = context.ServicesContext;
            AgentInstanceContext agentInstanceContext = context.AgentInstanceContext;

            // validate
            if (select.InsertIntoDesc != null)
            {
                throw new ExprValidationException("Insert-into clause is not supported");
            }
            if (select.SelectStreamSelectorEnum != SelectClauseStreamSelectorEnum.ISTREAM_ONLY)
            {
                throw new ExprValidationException("Selecting remove-stream is not supported");
            }
            ExprNodeSubselectDeclaredDotVisitor visitor            = StatementSpecRawAnalyzer.WalkSubselectAndDeclaredDotExpr(select);
            GroupByClauseExpressions            groupByExpressions = GroupByExpressionHelper.GetGroupByRollupExpressions(
                servicesContext.Container,
                select.GroupByExpressions,
                select.SelectClauseSpec,
                select.HavingExprRootNode,
                select.OrderByList,
                visitor);

            if (!visitor.Subselects.IsEmpty())
            {
                throw new ExprValidationException("Subselects are not supported");
            }

            IDictionary <int, FilterStreamSpecRaw> streams = new Dictionary <int, FilterStreamSpecRaw>();

            for (int streamNum = 0; streamNum < select.StreamSpecs.Count; streamNum++)
            {
                var rawStreamSpec = select.StreamSpecs[streamNum];
                if (!(rawStreamSpec is FilterStreamSpecRaw))
                {
                    throw new ExprValidationException("From-clause must contain only streams and cannot contain patterns or other constructs");
                }
                streams.Put(streamNum, (FilterStreamSpecRaw)rawStreamSpec);
            }

            // compile offered streams
            IList <StreamSpecCompiled> streamSpecCompileds = new List <StreamSpecCompiled>();

            for (int streamNum = 0; streamNum < select.StreamSpecs.Count; streamNum++)
            {
                var filter    = streams.Get(streamNum);
                var inputPort = FindInputPort(filter.RawFilterSpec.EventTypeName, context.InputPorts);
                if (inputPort == null)
                {
                    throw new ExprValidationException(
                              string.Format("Failed to find stream '{0}' among input ports, input ports are {1}", filter.RawFilterSpec.EventTypeName, GetInputPortNames(context.InputPorts).Render(", ", "[]")));
                }
                var eventType                = inputPort.Value.Value.TypeDesc.EventType;
                var streamAlias              = filter.OptionalStreamName;
                var filterSpecCompiled       = new FilterSpecCompiled(eventType, streamAlias, new IList <FilterSpecParam>[] { Collections.GetEmptyList <FilterSpecParam>() }, null);
                var filterStreamSpecCompiled = new FilterStreamSpecCompiled(filterSpecCompiled, select.StreamSpecs[0].ViewSpecs, streamAlias, StreamSpecOptions.DEFAULT);
                streamSpecCompileds.Add(filterStreamSpecCompiled);
            }

            // create compiled statement spec
            SelectClauseSpecCompiled selectClauseCompiled = StatementLifecycleSvcUtil.CompileSelectClause(select.SelectClauseSpec);

            // determine if snapshot output is needed
            OutputLimitSpec outputLimitSpec = select.OutputLimitSpec;

            _isOutputLimited = outputLimitSpec != null;
            if (iterate)
            {
                if (outputLimitSpec != null)
                {
                    throw new ExprValidationException("Output rate limiting is not supported with 'iterate'");
                }
                outputLimitSpec = new OutputLimitSpec(OutputLimitLimitType.SNAPSHOT, OutputLimitRateType.TERM);
            }

            var mergedAnnotations = AnnotationUtil.MergeAnnotations(statementContext.Annotations, context.OperatorAnnotations);
            var orderByArray      = OrderByItem.ToArray(select.OrderByList);
            var outerJoinArray    = OuterJoinDesc.ToArray(select.OuterJoinDescList);
            var streamSpecArray   = streamSpecCompileds.ToArray();
            var compiled          = new StatementSpecCompiled(null, null, null, null, null, null, null, SelectClauseStreamSelectorEnum.ISTREAM_ONLY,
                                                              selectClauseCompiled, streamSpecArray, outerJoinArray, select.FilterExprRootNode, select.HavingExprRootNode, outputLimitSpec,
                                                              orderByArray, ExprSubselectNode.EMPTY_SUBSELECT_ARRAY, ExprNodeUtility.EMPTY_DECLARED_ARR, ExprNodeUtility.EMPTY_SCRIPTS, select.ReferencedVariables,
                                                              select.RowLimitSpec, CollectionUtil.EMPTY_STRING_ARRAY, mergedAnnotations, null, null, null, null, null, null, null, null, null, groupByExpressions, null, null);

            // create viewable per port
            var viewables = new EPLSelectViewable[context.InputPorts.Count];

            _viewablesPerPort = viewables;
            foreach (var entry in context.InputPorts)
            {
                EPLSelectViewable viewable = new EPLSelectViewable(entry.Value.TypeDesc.EventType);
                viewables[entry.Key] = viewable;
            }

            var activatorFactory = new ProxyViewableActivatorFactory
            {
                ProcCreateActivatorSimple = filterStreamSpec =>
                {
                    EPLSelectViewable found = null;
                    foreach (EPLSelectViewable sviewable in viewables)
                    {
                        if (sviewable.EventType == filterStreamSpec.FilterSpec.FilterForEventType)
                        {
                            found = sviewable;
                        }
                    }
                    if (found == null)
                    {
                        throw new IllegalStateException("Failed to find viewable for filter");
                    }
                    EPLSelectViewable viewable = found;
                    return(new ProxyViewableActivator(
                               (agentInstanceContext2, isSubselect, isRecoveringResilient) =>
                               new ViewableActivationResult(
                                   viewable,
                                   new ProxyStopCallback(() => { }),
                                   null,
                                   null,
                                   null,
                                   false,
                                   false,
                                   null)));
                }
            };

            // for per-row deliver, register select expression result callback
            OutputProcessViewCallback optionalOutputProcessViewCallback = null;

            if (!iterate && !_isOutputLimited)
            {
                _deliveryCallback = new EPLSelectDeliveryCallback();
                optionalOutputProcessViewCallback = this;
            }

            // prepare
            EPStatementStartMethodSelectDesc selectDesc = EPStatementStartMethodSelectUtil.Prepare(compiled, servicesContext, statementContext, false, agentInstanceContext, false, activatorFactory, optionalOutputProcessViewCallback, _deliveryCallback);

            // start
            _selectResult = (StatementAgentInstanceFactorySelectResult)selectDesc.StatementAgentInstanceFactorySelect.NewContext(agentInstanceContext, false);

            // for output-rate-limited, register a dispatch view
            if (_isOutputLimited)
            {
                _selectResult.FinalView.AddView(new EPLSelectUpdateDispatchView(this));
            }

            // assign strategies to expression nodes
            EPStatementStartMethodHelperAssignExpr.AssignExpressionStrategies(
                selectDesc,
                _selectResult.OptionalAggegationService,
                _selectResult.SubselectStrategies,
                _selectResult.PriorNodeStrategies,
                _selectResult.PreviousNodeStrategies,
                null,
                null,
                _selectResult.TableAccessEvalStrategies);

            EventType outputEventType = selectDesc.ResultSetProcessorPrototypeDesc.ResultSetProcessorFactory.ResultEventType;

            _agentInstanceContext = agentInstanceContext;
            return(new DataFlowOpInitializeResult(new GraphTypeDesc[] { new GraphTypeDesc(false, true, outputEventType) }));
        }
示例#30
0
            public PropertyEntry(Type type, String propertyName)
            {
                this.propertyName = propertyName;
                LinkedHashSet <String> propertyNames = new LinkedHashSet <String>();

                propertyNames.Add(propertyName);
                PropertyInfo prop = type.GetProperty(propertyName);

                doesModifyToBeUpdated        = !AnnotationUtil.IsAnnotationPresent <IgnoreToBeUpdated>(prop, false);
                isParentChildSetter          = AnnotationUtil.IsAnnotationPresent <ParentChild>(prop, false);
                isAddedRemovedCheckNecessary = !prop.PropertyType.IsPrimitive && ImmutableTypeSet.GetUnwrappedType(prop.PropertyType) == null &&
                                               !typeof(String).Equals(prop.PropertyType) && !prop.PropertyType.IsValueType;

                EvaluateDependentProperties(type, prop, propertyNames);

                while (true)
                {
                    int startCount = propertyNames.Count;

                    foreach (String currPropertyName in new List <String>(propertyNames))
                    {
                        PropertyInfo currProp = type.GetProperty(currPropertyName);
                        if (currProp.CanWrite)
                        {
                            continue;
                        }
                        // Is is just an evaluating property which has to be re-evaluated because of the change on the current property
                        EvaluateDependentProperties(type, currProp, propertyNames);
                    }
                    if (startCount == propertyNames.Count)
                    {
                        break;
                    }
                }
                this.propertyNames = propertyNames.ToArray();
                bool firesToBeCreatedPCE = false;

                unknownValues = CreateArrayOfValues(UNKNOWN_VALUE, this.propertyNames.Length);
                pceArgs       = new PropertyChangedEventArgs[propertyNames.Count];
                int index = 0;

                foreach (String invokedPropertyName in propertyNames)
                {
                    pceArgs[index] = new PropertyChangedEventArgs(invokedPropertyName);
                    index++;
                    firesToBeCreatedPCE |= "ToBeCreated".Equals(invokedPropertyName);
                }
                this.firesToBeCreatedPCE = firesToBeCreatedPCE;
                if (prop.CanRead)
                {
                    getDelegate = TypeUtility.GetMemberGetDelegate(type, ValueHolderIEC.GetGetterNameOfRelationPropertyWithNoInit(prop.Name), true);
                    if (getDelegate == null)
                    {
                        getDelegate = TypeUtility.GetMemberGetDelegate(type, prop.Name);
                    }
                }
                if (prop.CanWrite)
                {
                    setDelegate = TypeUtility.GetMemberSetDelegate(type, ValueHolderIEC.GetSetterNameOfRelationPropertyWithNoInit(prop.Name), true);
                    if (setDelegate == null)
                    {
                        setDelegate = TypeUtility.GetMemberSetDelegate(type, prop.Name);
                    }
                }
            }