예제 #1
0
        private CGLibPropertyGetter MakeCGIGetter(Type clazz, String propertyName)
        {
            FastClass    fastClass    = FastClass.Create(clazz);
            PropertyInfo propertyInfo = clazz.GetProperty(propertyName);
            FastProperty fastProp     = fastClass.GetProperty(propertyInfo);

            CGLibPropertyGetter getter = new CGLibPropertyGetter(propertyInfo, fastProp, SupportEventAdapterService.Service);

            return(getter);
        }
예제 #2
0
        /// <summary>
        /// Return getter for the given method and CGLIB FastClass.
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="method">to return getter for</param>
        /// <param name="fastClass">is the CGLIB fast classs to make FastMethod for</param>
        /// <param name="eventAdapterService">factory for event beans and event types</param>
        /// <returns>property getter</returns>
        public static EventPropertyGetter GetGetter(String propertyName, MethodInfo method, FastClass fastClass, EventAdapterService eventAdapterService)
        {
            // Construct the appropriate property getter CGLib or reflect
            if (fastClass != null)
            {
#if true
                var fastProp = fastClass.GetProperty(propertyName);
                if (fastProp != null)
                {
                    return(new CGLibPropertyGetter(fastProp.Target, fastProp, eventAdapterService));
                }
                else
                {
                    return(new CGLibPropertyMethodGetter(method, fastClass.GetMethod(method), eventAdapterService));
                }
#else
                return(new LambdaPropertyGetter(method, eventAdapterService));
#endif
            }
            else
            {
                return(new ReflectionPropMethodGetter(method, eventAdapterService));
            }
        }