public static Object getFieldVal(Object obj, String fieldName) {
        Field field;
        if (obj == null) {
            return null;
        }
        try {
            field = getField(obj.getClass(), fieldName);
            field.setAccessible(true);//取消安全机制限制
            return field.get(obj);
        } catch (SecurityException e) {
            e.printStackTrace();
            return null;
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
            return null;
        } catch (IllegalAccessException e) {
            e.printStackTrace();
            return null;
        }
    }
public static Object getFieldVal ( Object obj , String fieldName ) { Field field ; if ( obj == null ) { return null ; } try { field = getField ( obj . getClass ( ) , fieldName ) ; field . setAccessible ( true ) ; return field . get ( obj ) ; } catch ( SecurityException e ) { e . printStackTrace ( ) ; return null ; } catch ( IllegalArgumentException e ) { e . printStackTrace ( ) ; return null ; } catch ( IllegalAccessException e ) { e . printStackTrace ( ) ; return null ; } }
获取指定类字段属性值
<p>Function: getFieldVal</p>
<p>Description: 取消安全访问限制，如果当前类不存在，则获取父类属性值  发生异常则返回NULL</p>

@param obj
@param fieldName
@return
@author acexy@thankjava.com
@date 2014-12-16 上午11:28:20
@version 1.0