コード例 #1
0
ファイル: SimpleProperty.cs プロジェクト: lanicon/nesper
 public override GenericPropertyDesc GetPropertyTypeGeneric(
     BeanEventType eventType,
     BeanEventTypeFactory beanEventTypeFactory)
 {
     var propertyDesc = eventType.GetSimpleProperty(PropertyNameAtomic);
     return propertyDesc?.ReturnTypeGeneric;
 }
コード例 #2
0
        public override GenericPropertyDesc GetPropertyTypeGeneric(BeanEventType eventType, EventAdapterService eventAdapterService)
        {
            var propertyDesc = eventType.GetSimpleProperty(PropertyNameAtomic);

            if (propertyDesc == null)
            {
                return(null);
            }
            return(propertyDesc.GetReturnTypeGeneric());
        }
コード例 #3
0
ファイル: MappedProperty.cs プロジェクト: ikvm/nesper
        public override EventPropertyGetter GetGetter(BeanEventType eventType, EventAdapterService eventAdapterService)
        {
            InternalEventPropDescriptor propertyDesc = eventType.GetMappedProperty(PropertyNameAtomic);

            if (propertyDesc != null)
            {
                var method    = propertyDesc.ReadMethod;
                var fastClass = eventType.FastClass;
                if (fastClass != null)
                {
                    var fastMethod = fastClass.GetMethod(method);
                    return(new KeyedFastPropertyGetter(fastMethod, _key, eventAdapterService));
                }
                else
                {
                    return(new KeyedMethodPropertyGetter(method, _key, eventAdapterService));
                }
            }

            // Try the array as a simple property
            propertyDesc = eventType.GetSimpleProperty(PropertyNameAtomic);
            if (propertyDesc == null)
            {
                return(null);
            }

            var returnType = propertyDesc.ReturnType;

            // Unlike Java, CLR based maps are strongly typed ... the mechanics
            // for identifying and extracting the map contents are also different.
            if (!returnType.IsGenericStringDictionary())
            {
                return(null);
            }

            if (propertyDesc.ReadMethod != null)
            {
                var fastClass = eventType.FastClass;
                var method    = propertyDesc.ReadMethod;
                if (fastClass != null)
                {
                    var fastMethod = fastClass.GetMethod(method);
                    return(new KeyedMapFastPropertyGetter(method, fastMethod, _key, eventAdapterService));
                }
                else
                {
                    return(new KeyedMapMethodPropertyGetter(method, _key, eventAdapterService));
                }
            }
            else
            {
                var field = propertyDesc.AccessorField;
                return(new KeyedMapFieldPropertyGetter(field, _key, eventAdapterService));
            }
        }
コード例 #4
0
        public override EventPropertyGetter GetGetter(BeanEventType eventType, EventAdapterService eventAdapterService)
        {
            var propertyDesc = eventType.GetSimpleProperty(PropertyNameAtomic);

            if (propertyDesc == null)
            {
                return(null);
            }
            if (!propertyDesc.PropertyType.Equals(EventPropertyType.SIMPLE))
            {
                return(null);
            }
            return(eventType.GetGetter(PropertyNameAtomic));
        }
コード例 #5
0
ファイル: SimpleProperty.cs プロジェクト: lanicon/nesper
        public override EventPropertyGetterSPI GetGetter(
            BeanEventType eventType,
            EventBeanTypedEventFactory eventBeanTypedEventFactory,
            BeanEventTypeFactory beanEventTypeFactory)
        {
            var propertyDesc = eventType.GetSimpleProperty(PropertyNameAtomic);
            if (propertyDesc == null) {
                return null;
            }

            if (!propertyDesc.PropertyType.IsSimple()) {
                return null;
            }

            return eventType.GetGetterSPI(PropertyNameAtomic);
        }
コード例 #6
0
ファイル: IndexedProperty.cs プロジェクト: qinfengzhu/nesper
        public override Type GetPropertyType(BeanEventType eventType, EventAdapterService eventAdapterService)
        {
            var descriptor = eventType.GetIndexedProperty(PropertyNameAtomic);

            if (descriptor != null)
            {
                return(descriptor.ReturnType);
            }

            // Check if this is an method returning array which is a type of simple property
            descriptor = eventType.GetSimpleProperty(PropertyNameAtomic);
            if (descriptor == null)
            {
                return(null);
            }

            return(descriptor.ReturnType.GetIndexType());
        }
コード例 #7
0
ファイル: IndexedProperty.cs プロジェクト: qinfengzhu/nesper
        public override GenericPropertyDesc GetPropertyTypeGeneric(BeanEventType eventType,
                                                                   EventAdapterService eventAdapterService)
        {
            var descriptor = eventType.GetIndexedProperty(PropertyNameAtomic);

            if (descriptor != null)
            {
                return(new GenericPropertyDesc(descriptor.ReturnType));
            }

            // Check if this is an method returning array which is a type of simple property
            descriptor = eventType.GetSimpleProperty(PropertyNameAtomic);
            if (descriptor == null)
            {
                return(null);
            }

            var returnType = descriptor.ReturnType;

            if (returnType.IsArray)
            {
                return(new GenericPropertyDesc(returnType.GetElementType()));
            }
            else if (returnType.IsImplementsInterface(typeof(IEnumerable)))
            {
                if (descriptor.ReadMethod != null)
                {
                    var genericType = TypeHelper.GetGenericReturnType(descriptor.ReadMethod, false);
                    return(new GenericPropertyDesc(genericType));
                }
                else if (descriptor.AccessorField != null)
                {
                    var genericType = TypeHelper.GetGenericFieldType(descriptor.AccessorField, false);
                    return(new GenericPropertyDesc(genericType));
                }
                else
                {
                    return(null);
                }
            }
            return(null);
        }
コード例 #8
0
ファイル: MappedProperty.cs プロジェクト: ikvm/nesper
        public override GenericPropertyDesc GetPropertyTypeGeneric(BeanEventType eventType, EventAdapterService eventAdapterService)
        {
            var propertyDesc = eventType.GetMappedProperty(PropertyNameAtomic);

            if (propertyDesc != null)
            {
                return(new GenericPropertyDesc(propertyDesc.ReadMethod.ReturnType));
            }

            // Check if this is an method returning array which is a type of simple property
            var descriptor = eventType.GetSimpleProperty(PropertyNameAtomic);

            if (descriptor == null)
            {
                return(null);
            }

            var returnType = descriptor.ReturnType;

            if (!returnType.IsGenericStringDictionary())
            {
                return(null);
            }
            if (descriptor.ReadMethod != null)
            {
                var genericType = TypeHelper.GetGenericReturnTypeMap(descriptor.ReadMethod, false);
                return(new GenericPropertyDesc(genericType));
            }
            else if (descriptor.AccessorField != null)
            {
                var genericType = TypeHelper.GetGenericFieldTypeMap(descriptor.AccessorField, false);
                return(new GenericPropertyDesc(genericType));
            }
            else
            {
                return(null);
            }
        }
コード例 #9
0
ファイル: IndexedProperty.cs プロジェクト: qinfengzhu/nesper
        public override EventPropertyGetterSPI GetGetter(BeanEventType eventType, EventAdapterService eventAdapterService)
        {
            var fastClass    = eventType.FastClass;
            var propertyDesc = eventType.GetIndexedProperty(PropertyNameAtomic);

            if (propertyDesc != null)
            {
                if (fastClass != null)
                {
                    var method     = propertyDesc.ReadMethod;
                    var fastMethod = fastClass.GetMethod(method);
                    return(new KeyedFastPropertyGetter(fastMethod, _index, eventAdapterService));
                }
                else
                {
                    return(new KeyedMethodPropertyGetter(propertyDesc.ReadMethod, _index, eventAdapterService));
                }
            }

            // Try the array as a simple property
            propertyDesc = eventType.GetSimpleProperty(PropertyNameAtomic);
            if (propertyDesc == null)
            {
                return(null);
            }

            var returnType = propertyDesc.ReturnType;

            if (returnType == typeof(string))
            {
                if (propertyDesc.ReadMethod != null)
                {
                    var method = propertyDesc.ReadMethod;
                    if (fastClass != null)
                    {
                        var fastMethod = fastClass.GetMethod(method);
                        return(new StringFastPropertyGetter(fastMethod, _index, eventAdapterService));
                    }
                    else
                    {
                        return(new StringMethodPropertyGetter(method, _index, eventAdapterService));
                    }
                }
                else
                {
                    var field = propertyDesc.AccessorField;
                    return(new StringFieldPropertyGetter(field, _index, eventAdapterService));
                }
            }
            else if (returnType.IsArray)
            {
                if (propertyDesc.ReadMethod != null)
                {
                    var method = propertyDesc.ReadMethod;
                    if (fastClass != null)
                    {
                        var fastMethod = fastClass.GetMethod(method);
                        return(new ArrayFastPropertyGetter(fastMethod, _index, eventAdapterService));
                    }
                    else
                    {
                        return(new ArrayMethodPropertyGetter(method, _index, eventAdapterService));
                    }
                }
                else
                {
                    var field = propertyDesc.AccessorField;
                    return(new ArrayFieldPropertyGetter(field, _index, eventAdapterService));
                }
            }
            else if (returnType.IsGenericDictionary())
            {
            }
            else if (returnType.IsGenericList())
            {
                if (propertyDesc.ReadMethod != null)
                {
                    var method = propertyDesc.ReadMethod;
                    if (fastClass != null)
                    {
                        var fastMethod = fastClass.GetMethod(method);
                        return(new ListFastPropertyGetter(method, fastMethod, _index, eventAdapterService));
                    }
                    else
                    {
                        return(new ListMethodPropertyGetter(method, _index, eventAdapterService));
                    }
                }
                else
                {
                    var field = propertyDesc.AccessorField;
                    return(new ListFieldPropertyGetter(field, _index, eventAdapterService));
                }
            }
            else if (returnType.IsImplementsInterface(typeof(IEnumerable)))
            {
                if (propertyDesc.ReadMethod != null)
                {
                    var method = propertyDesc.ReadMethod;
                    if (fastClass != null)
                    {
                        var fastMethod = fastClass.GetMethod(method);
                        return(new EnumerableFastPropertyGetter(method, fastMethod, _index, eventAdapterService));
                    }
                    else
                    {
                        return(new EnumerableMethodPropertyGetter(method, _index, eventAdapterService));
                    }
                }
                else
                {
                    var field = propertyDesc.AccessorField;
                    return(new EnumerableFieldPropertyGetter(field, _index, eventAdapterService));
                }
            }

            return(null);
        }
コード例 #10
0
        public override EventPropertyGetter GetGetter(BeanEventType eventType, EventAdapterService eventAdapterService)
        {
            FastClass fastClass = eventType.FastClass;
            InternalEventPropDescriptor propertyDesc = eventType.GetIndexedProperty(PropertyNameAtomic);

            if (propertyDesc != null)
            {
                if (fastClass != null)
                {
                    MethodInfo method     = propertyDesc.ReadMethod;
                    FastMethod fastMethod = fastClass.GetMethod(method);
                    return(new KeyedFastPropertyGetter(fastMethod, _index, eventAdapterService));
                }
                else
                {
                    return(new KeyedMethodPropertyGetter(propertyDesc.ReadMethod, _index, eventAdapterService));
                }
            }

            // Try the array as a simple property
            propertyDesc = eventType.GetSimpleProperty(PropertyNameAtomic);
            if (propertyDesc == null)
            {
                return(null);
            }

            Type returnType = propertyDesc.ReturnType;

            if (returnType.IsArray)
            {
                if (propertyDesc.ReadMethod != null)
                {
                    MethodInfo method = propertyDesc.ReadMethod;
                    if (fastClass != null)
                    {
                        FastMethod fastMethod = fastClass.GetMethod(method);
                        return(new ArrayFastPropertyGetter(fastMethod, _index, eventAdapterService));
                    }
                    else
                    {
                        return(new ArrayMethodPropertyGetter(method, _index, eventAdapterService));
                    }
                }
                else
                {
                    FieldInfo field = propertyDesc.AccessorField;
                    return(new ArrayFieldPropertyGetter(field, _index, eventAdapterService));
                }
            }
            else if (returnType.IsImplementsInterface(typeof(IList <object>)))
            {
                if (propertyDesc.ReadMethod != null)
                {
                    MethodInfo method = propertyDesc.ReadMethod;
                    if (fastClass != null)
                    {
                        FastMethod fastMethod = fastClass.GetMethod(method);
                        return(new ListFastPropertyGetter(method, fastMethod, _index, eventAdapterService));
                    }
                    else
                    {
                        return(new ListMethodPropertyGetter(method, _index, eventAdapterService));
                    }
                }
                else
                {
                    FieldInfo field = propertyDesc.AccessorField;
                    return(new ListFieldPropertyGetter(field, _index, eventAdapterService));
                }
            }
            else if (returnType.IsImplementsInterface(typeof(IEnumerable)))
            {
                if (propertyDesc.ReadMethod != null)
                {
                    MethodInfo method = propertyDesc.ReadMethod;
                    if (fastClass != null)
                    {
                        FastMethod fastMethod = fastClass.GetMethod(method);
                        return(new EnumerableFastPropertyGetter(method, fastMethod, _index, eventAdapterService));
                    }
                    else
                    {
                        return(new EnumerableMethodPropertyGetter(method, _index, eventAdapterService));
                    }
                }
                else
                {
                    FieldInfo field = propertyDesc.AccessorField;
                    return(new EnumerableFieldPropertyGetter(field, _index, eventAdapterService));
                }
            }

            return(null);
        }