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);
     }
 }
        public Object GetBeanPropInternal(Object @object, Object key)
        {
            try {
                var result = _field.GetValue(@object);
                if (result == null) {
                    return null;
                }

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

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

                return null;
            }
            catch (PropertyAccessException) {
                throw;
            }
            catch (InvalidCastException e) {
                throw PropertyUtility.GetMismatchException(_field, @object, e);
            }
            catch (ArgumentException e) {
                throw PropertyUtility.GetIllegalArgumentException(_field, e);
            }
            catch (Exception e) {
                throw PropertyUtility.GetAccessExceptionField(_field, e);
            }
        }
 public Object GetBeanProp(Object @object)
 {
     try
     {
         return _field.GetValue(@object);
     }
     catch (ArgumentException e)
     {
         throw PropertyUtility.GetIllegalArgumentException(_field, e);
     }
     catch (PropertyAccessException)
     {
         throw;
     }
     catch (Exception e)
     {
         throw new PropertyAccessException(e);
     }
 }
Esempio n. 4
0
 public Object GetBeanProp(Object o)
 {
     try
     {
         return(_method.Invoke(o, null));
     }
     catch (ArgumentException e)
     {
         throw PropertyUtility.GetIllegalArgumentException(_method, e);
     }
     catch (PropertyAccessException)
     {
         throw;
     }
     catch (Exception e)
     {
         throw new PropertyAccessException(e);
     }
 }
        public Object GetBeanPropInternal(Object @object, Object key)
        {
            try
            {
                var result = _field.GetValue(@object) as DataMap;
                if (result == null)
                {
                    return(null);
                }

                return(result.Get(Convert.ToString(key)));
            }
            catch (InvalidCastException e)
            {
                throw PropertyUtility.GetMismatchException(_field, @object, e);
            }
            catch (ArgumentException e)
            {
                throw PropertyUtility.GetIllegalArgumentException(_field, e);
            }
        }
Esempio n. 6
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. 7
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);
     }
 }
 private object GetBeanPropInternal(object @object, int index)
 {
     try
     {
         var value = _field.GetValue(@object);
         if (!(value is IList<object>)) return null;
         var valueList = (IList<object>) value;
         if (valueList.Count <= index) return null;
         return valueList[index];
     }
     catch (InvalidCastException e)
     {
         throw PropertyUtility.GetMismatchException(_field, @object, e);
     }
     catch (MemberAccessException e)
     {
         throw PropertyUtility.GetIllegalAccessException(_field, e);
     }
     catch (ArgumentException e)
     {
         throw PropertyUtility.GetIllegalArgumentException(_field, e);
     }
 }
Esempio n. 9
0
 private Object GetBeanPropInternal(Object @object, int index)
 {
     try
     {
         var value = (Array)_field.GetValue(@object);
         if (value.Length <= index)
         {
             return(null);
         }
         return(value.GetValue(index));
     }
     catch (InvalidCastException e)
     {
         throw PropertyUtility.GetMismatchException(_field, @object, e);
     }
     catch (MethodAccessException e)
     {
         throw PropertyUtility.GetIllegalAccessException(_field, e);
     }
     catch (ArgumentException e)
     {
         throw PropertyUtility.GetIllegalArgumentException(_field, e);
     }
 }