/** * Returns the value of the field in the specified object as an {@code int}. * This reproduces the effect of {@code object.fieldName} * <p> * If this field is static, the object argument is ignored. * Otherwise, if the object is {@code null}, a NullPointerException is * thrown. If the object is not an instance of the declaring class of the * method, an IllegalArgumentException is thrown. * <p> * If this Field object is enforcing access control (see AccessibleObject) * and this field is not accessible from the current context, an * IllegalAccessException is thrown. * * @param object * the object to access * @return the field value * @throws NullPointerException * if the object is {@code null} and the field is non-static * @throws IllegalArgumentException * if the object is not compatible with the declaring class * @throws IllegalAccessException * if this field is not accessible */ public int getInt(Object object) throws IllegalAccessException, IllegalArgumentException { checkAccess(object, false); checkReceiver(object); return getInt(object, getType(), Integer.TYPE); }
/** * Returns the value of the field in the specified object as a {@code long}. * This reproduces the effect of {@code object.fieldName} * <p> * If this field is static, the object argument is ignored. * Otherwise, if the object is {@code null}, a NullPointerException is * thrown. If the object is not an instance of the declaring class of the * method, an IllegalArgumentException is thrown. * <p> * If this Field object is enforcing access control (see AccessibleObject) * and this field is not accessible from the current context, an * IllegalAccessException is thrown. * * @param object * the object to access * @return the field value * @throws NullPointerException * if the object is {@code null} and the field is non-static * @throws IllegalArgumentException * if the object is not compatible with the declaring class * @throws IllegalAccessException * if this field is not accessible */ public long getLong(Object object) throws IllegalAccessException, IllegalArgumentException { checkAccess(object, false); checkReceiver(object); return getLong(object, getType(), Long.TYPE); }
/** * Returns the value of the field in the specified object as a {@code * boolean}. This reproduces the effect of {@code object.fieldName} * <p> * If this field is static, the object argument is ignored. * Otherwise, if the object is {@code null}, a NullPointerException is * thrown. If the object is not an instance of the declaring class of the * method, an IllegalArgumentException is thrown. * <p> * If this Field object is enforcing access control (see AccessibleObject) * and this field is not accessible from the current context, an * IllegalAccessException is thrown. * * @param object * the object to access * @return the field value * @throws NullPointerException * if the object is {@code null} and the field is non-static * @throws IllegalArgumentException * if the object is not compatible with the declaring class * @throws IllegalAccessException * if this field is not accessible */ public boolean getBoolean(Object object) throws IllegalAccessException, IllegalArgumentException { checkAccess(object, false); checkReceiver(object); return getBoolean(object, getType(), Boolean.TYPE); }
checkReceiver(object); setLong(object, value, getType(), Long.TYPE);
checkReceiver(object); setBoolean(object, value, getType(), Boolean.TYPE);
checkReceiver(object); setInt(object, value, getType(), Integer.TYPE);
/** * Returns the value of the field in the specified object as a {@code byte}. * This reproduces the effect of {@code object.fieldName} * <p> * If this field is static, the object argument is ignored. * Otherwise, if the object is {@code null}, a NullPointerException is * thrown. If the object is not an instance of the declaring class of the * method, an IllegalArgumentException is thrown. * <p> * If this Field object is enforcing access control (see AccessibleObject) * and this field is not accessible from the current context, an * IllegalAccessException is thrown. * * @param object * the object to access * @return the field value * @throws NullPointerException * if the object is {@code null} and the field is non-static * @throws IllegalArgumentException * if the object is not compatible with the declaring class * @throws IllegalAccessException * if this field is not accessible */ public byte getByte(Object object) throws IllegalAccessException, IllegalArgumentException { checkAccess(object, false); checkReceiver(object); return getByte(object, getType(), Byte.TYPE); }
/** * Returns the value of the field in the specified object as a {@code char}. * This reproduces the effect of {@code object.fieldName} * <p> * If this field is static, the object argument is ignored. * Otherwise, if the object is {@code null}, a NullPointerException is * thrown. If the object is not an instance of the declaring class of the * method, an IllegalArgumentException is thrown. * <p> * If this Field object is enforcing access control (see AccessibleObject) * and this field is not accessible from the current context, an * IllegalAccessException is thrown. * * @param object * the object to access * @return the field value * @throws NullPointerException * if the object is {@code null} and the field is non-static * @throws IllegalArgumentException * if the object is not compatible with the declaring class * @throws IllegalAccessException * if this field is not accessible */ public char getChar(Object object) throws IllegalAccessException, IllegalArgumentException { checkAccess(object, false); checkReceiver(object); return getChar(object, getType(), Character.TYPE); }
/** * Returns the value of the field in the specified object as a {@code float}. * This reproduces the effect of {@code object.fieldName} * <p> * If this field is static, the object argument is ignored. * Otherwise, if the object is {@code null}, a NullPointerException is * thrown. If the object is not an instance of the declaring class of the * method, an IllegalArgumentException is thrown. * <p> * If this Field object is enforcing access control (see AccessibleObject) * and this field is not accessible from the current context, an * IllegalAccessException is thrown. * * @param object * the object to access * @return the field value * @throws NullPointerException * if the object is {@code null} and the field is non-static * @throws IllegalArgumentException * if the object is not compatible with the declaring class * @throws IllegalAccessException * if this field is not accessible */ public float getFloat(Object object) throws IllegalAccessException, IllegalArgumentException { checkAccess(object, false); checkReceiver(object); return getFloat(object, getType(), Float.TYPE); }
/** * Returns the value of the field in the specified object as a {@code short} * . This reproduces the effect of {@code object.fieldName} * <p> * If this field is static, the object argument is ignored. * Otherwise, if the object is {@code null}, a NullPointerException is * thrown. If the object is not an instance of the declaring class of the * method, an IllegalArgumentException is thrown. * <p> * If this Field object is enforcing access control (see AccessibleObject) * and this field is not accessible from the current context, an * IllegalAccessException is thrown. * * @param object * the object to access * @return the field value * @throws NullPointerException * if the object is {@code null} and the field is non-static * @throws IllegalArgumentException * if the object is not compatible with the declaring class * @throws IllegalAccessException * if this field is not accessible */ public short getShort(Object object) throws IllegalAccessException, IllegalArgumentException { checkAccess(object, false); checkReceiver(object); return getShort(object, getType(), Short.TYPE); }
/** * Returns the value of the field in the specified object as a {@code * double}. This reproduces the effect of {@code object.fieldName} * <p> * If this field is static, the object argument is ignored. * Otherwise, if the object is {@code null}, a NullPointerException is * thrown. If the object is not an instance of the declaring class of the * method, an IllegalArgumentException is thrown. * <p> * If this Field object is enforcing access control (see AccessibleObject) * and this field is not accessible from the current context, an * IllegalAccessException is thrown. * * @param object * the object to access * @return the field value * @throws NullPointerException * if the object is {@code null} and the field is non-static * @throws IllegalArgumentException * if the object is not compatible with the declaring class * @throws IllegalAccessException * if this field is not accessible */ public double getDouble(Object object) throws IllegalAccessException, IllegalArgumentException { checkAccess(object, false); checkReceiver(object); return getDouble(object, getType(), Double.TYPE); }
checkReceiver(object); setByte(object, value, getType(), Byte.TYPE);
checkReceiver(object); setShort(object, value, getType(), Short.TYPE);
checkReceiver(object); setChar(object, value, getType(), Character.TYPE);
checkReceiver(object); setDouble(object, value, getType(), Double.TYPE);
checkReceiver(object); setFloat(object, value, getType(), Float.TYPE);
checkReceiver(object); Class<?> type = getType(); if (type.isPrimitive()) {
checkReceiver(object); Class<?> type = getType(); if (type.isPrimitive()) {
/** * Returns the value of the field in the specified object as a {@code char}. * This reproduces the effect of {@code object.fieldName} * <p> * If this field is static, the object argument is ignored. * Otherwise, if the object is {@code null}, a NullPointerException is * thrown. If the object is not an instance of the declaring class of the * method, an IllegalArgumentException is thrown. * <p> * If this Field object is enforcing access control (see AccessibleObject) * and this field is not accessible from the current context, an * IllegalAccessException is thrown. * * @param object * the object to access * @return the field value * @throws NullPointerException * if the object is {@code null} and the field is non-static * @throws IllegalArgumentException * if the object is not compatible with the declaring class * @throws IllegalAccessException * if this field is not accessible */ public char getChar(Object object) throws IllegalAccessException, IllegalArgumentException { checkAccess(object, false); checkReceiver(object); return getChar(object, getType(), Character.TYPE); }
/** * Returns the value of the field in the specified object as a {@code char}. * This reproduces the effect of {@code object.fieldName} * <p> * If this field is static, the object argument is ignored. * Otherwise, if the object is {@code null}, a NullPointerException is * thrown. If the object is not an instance of the declaring class of the * method, an IllegalArgumentException is thrown. * <p> * If this Field object is enforcing access control (see AccessibleObject) * and this field is not accessible from the current context, an * IllegalAccessException is thrown. * * @param object * the object to access * @return the field value * @throws NullPointerException * if the object is {@code null} and the field is non-static * @throws IllegalArgumentException * if the object is not compatible with the declaring class * @throws IllegalAccessException * if this field is not accessible */ public char getChar(Object object) throws IllegalAccessException, IllegalArgumentException { checkAccess(object, false); checkReceiver(object); return getChar(object, getType(), Character.TYPE); }