Exemple #1
0
        public EventPropertyGetter GetGetter(BeanEventType eventType, EventAdapterService eventAdapterService)
        {
            var getters = new List <EventPropertyGetter>();

            Property lastProperty = null;

            for (var it = Properties.EnumerateWithLookahead(); it.HasNext();)
            {
                Property property = it.Next();
                lastProperty = property;
                EventPropertyGetter getter = property.GetGetter(eventType, eventAdapterService);
                if (getter == null)
                {
                    return(null);
                }

                if (it.HasNext())
                {
                    var clazz = property.GetPropertyType(eventType, eventAdapterService);
                    if (clazz == null)
                    {
                        // if the property is not valid, return null
                        return(null);
                    }
                    // Map cannot be used to further nest as the type cannot be determined
                    if (clazz == typeof(Map))
                    {
                        return(null);
                    }
                    if (clazz.IsArray)
                    {
                        return(null);
                    }
                    eventType = eventAdapterService.BeanEventTypeFactory.CreateBeanType(
                        clazz.FullName, clazz, false, false, false);
                }
                getters.Add(getter);
            }

            GenericPropertyDesc finalPropertyType = lastProperty.GetPropertyTypeGeneric(eventType, eventAdapterService);

            return(new NestedPropertyGetter(getters, eventAdapterService, finalPropertyType.GenericType, finalPropertyType.Generic));
        }
Exemple #2
0
        public GenericPropertyDesc GetPropertyTypeGeneric(BeanEventType eventType, EventAdapterService eventAdapterService)
        {
            GenericPropertyDesc result = null;

            for (var it = Properties.EnumerateWithLookahead(); it.HasNext();)
            {
                Property property = it.Next();
                result = property.GetPropertyTypeGeneric(eventType, eventAdapterService);

                if (result == null)
                {
                    // property not found, return null
                    return(null);
                }

                if (it.HasNext())
                {
                    // Map cannot be used to further nest as the type cannot be determined
                    if (result.GenericType == typeof(Map))
                    {
                        return(null);
                    }

                    if (result.GenericType.IsArray)
                    {
                        return(null);
                    }

                    eventType = eventAdapterService.BeanEventTypeFactory.CreateBeanType(
                        result.GenericType.FullName,
                        result.GenericType,
                        false, false, false);
                }
            }

            return(result);
        }
Exemple #3
0
 static GenericPropertyDesc()
 {
     ObjectGeneric = new GenericPropertyDesc(typeof(Object));
 }