public Object GetBeanPropInternal(Object @object, Object key)
 {
     try
     {
         Object result = _method.Invoke(@object, null);
         if (!(result is DataMap))
         {
             return(null);
         }
         DataMap resultMap = (DataMap)result;
         return(resultMap.Get(key));
     }
     catch (InvalidCastException e)
     {
         throw PropertyUtility.GetMismatchException(_method, @object, e);
     }
     catch (TargetInvocationException e)
     {
         throw PropertyUtility.GetInvocationTargetException(_method, e);
     }
     catch (ArgumentException e)
     {
         throw new PropertyAccessException(e);
     }
 }
        public Object GetBeanPropInternal(Object @object, int index)
        {
            try
            {
                var value = _fastMethod.Invoke(@object, null).AsObjectList();
                if (value == null)
                {
                    return null;
                }

                if (value.Count <= index)
                {
                    return null;
                }
                return value[index];
            }
            catch (InvalidCastException e)
            {
                throw PropertyUtility.GetMismatchException(_fastMethod.Target, @object, e);
            }
            catch (TargetInvocationException e)
            {
                throw PropertyUtility.GetInvocationTargetException(_fastMethod.Target, e);
            }
        }
 private object GetBeanPropInternal(object @object, int index)
 {
     try {
         var value = _method.Invoke(@object, null) as Array;
         if (value == null)
             return null;
         if (value.Length <= index)
             return null;
         return value.GetValue(index);
     }
     catch (InvalidCastException e) {
         throw PropertyUtility.GetMismatchException(_method, @object, e);
     }
     catch (TargetInvocationException e) {
         throw PropertyUtility.GetInvocationTargetException(_method, e);
     }
     catch (TargetException e) {
         throw PropertyUtility.GetGenericException(_method, e);
     }
     catch (MemberAccessException e) {
         throw PropertyUtility.GetIllegalAccessException(_method, e);
     }
     catch (ArgumentException e) {
         throw PropertyUtility.GetIllegalArgumentException(_method, e);
     }
 }
Esempio n. 4
0
        public object GetBeanPropInternal(object @object, int index)
        {
            try
            {
                var value = _method.Invoke(@object, (object[])null).AsObjectList();
                if (value == null)
                {
                    return(null);
                }

                if (value.Count <= index)
                {
                    return(null);
                }

                return(value[index]);
            }
            catch (InvalidCastException e)
            {
                throw PropertyUtility.GetMismatchException(_method, @object, e);
            }
            catch (TargetInvocationException e)
            {
                throw PropertyUtility.GetInvocationTargetException(_method, e);
            }
            catch (ArgumentException e)
            {
                throw new PropertyAccessException(e);
            }
        }
        public Object GetBeanPropInternal(Object @object, Object key)
        {
            try {
                var result = _fastMethod.Invoke(@object, null);
                if (result == null) {
                    return null;
                }

                if (result is Map) {
                    return ((Map) result).Get(key);
                }

                if (result.GetType().IsGenericDictionary()) {
                    return MagicMarker
                        .GetDictionaryFactory(result.GetType())
                        .Invoke(result)
                        .Get(key);
                }

                return null;
            }
            catch (PropertyAccessException) {
                throw;
            }
            catch (InvalidCastException e) {
                throw PropertyUtility.GetMismatchException(_fastMethod.Target, @object, e);
            }
            catch (TargetInvocationException e) {
                throw PropertyUtility.GetInvocationTargetException(_fastMethod.Target, e);
            }
            catch (Exception e) {
                throw PropertyUtility.GetAccessExceptionMethod(_fastMethod.Target, e);
            }
        }
Esempio n. 6
0
 public Object GetBeanPropInternal(Object @object, String key)
 {
     try
     {
         var result = _fastMethod.Invoke(@object, null);
         return(GenericExtensions.FetchKeyedValue(result, key, null));
     }
     catch (InvalidCastException e)
     {
         throw PropertyUtility.GetMismatchException(_fastMethod.Target, @object, e);
     }
     catch (TargetInvocationException e)
     {
         throw PropertyUtility.GetInvocationTargetException(_fastMethod.Target, e);
     }
 }
 private object GetBeanPropInternal(object @object, int index)
 {
     try
     {
         var value = (Array) _fastMethod.Invoke(@object, null);
         if (value.Length <= index) return null;
         return value.GetValue(index);
     }
     catch (InvalidCastException e)
     {
         throw PropertyUtility.GetMismatchException(_fastMethod.Target, @object, e);
     }
     catch (TargetInvocationException e)
     {
         throw PropertyUtility.GetInvocationTargetException(_fastMethod.Target, e);
     }
 }
Esempio n. 8
0
 private Object GetBeanPropInternal(Object @object, Object key)
 {
     try {
         return _method.Invoke(@object, new object[] {key});
     }
     catch (PropertyAccessException) {
         throw;
     }
     catch (InvalidCastException e) {
         throw PropertyUtility.GetMismatchException(_method, @object, e);
     }
     catch (TargetInvocationException e) {
         throw PropertyUtility.GetInvocationTargetException(_method, e);
     }
     catch (ArgumentException e) {
         throw PropertyUtility.GetIllegalArgumentException(_method, e);
     }
     catch (Exception e) {
         throw PropertyUtility.GetAccessExceptionMethod(_method, e);
     }
 }
Esempio n. 9
0
 private Object GetBeanPropInternal(Object o, Object key)
 {
     try
     {
         return(_method.Invoke(o, new[] { key }));
     }
     catch (InvalidCastException e)
     {
         throw PropertyUtility.GetMismatchException(_method, o, e);
     }
     catch (TargetException e)
     {
         throw PropertyUtility.GetTargetException(_method, e);
     }
     catch (TargetInvocationException e)
     {
         throw PropertyUtility.GetInvocationTargetException(_method, e);
     }
     catch (ArgumentException e)
     {
         throw PropertyUtility.GetIllegalArgumentException(_method, e);
     }
 }