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);
            }
        }
示例#2
0
 public Object GetBeanPropInternal(Object @object, Object key)
 {
     try {
         return _fastMethod.Invoke(@object, new Object[] {key});
     }
     catch (PropertyAccessException) {
         throw;
     }
     catch (InvalidCastException e) {
         throw PropertyUtility.GetMismatchException(_fastMethod.Target, @object, e);
     }
     catch (Exception e) {
         throw PropertyUtility.GetAccessExceptionMethod(_fastMethod.Target, e);
     }
 }
示例#3
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);
     }
 }