Android Utililty Methods Field Get

List of utility methods to do Field Get

Description

The list of methods to do Field Get are organized into topic(s).

Method

ObjectgetPrivateField(Object target, String fieldName)
get Private Field
Field field = target.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
return field.get(target);
ObjectgetPrivateField(Object target, String fieldName)
get Private Field
Field field = target.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
return field.get(target);
TgetPrivateField(Object target, String fieldName, Class type)
get Private Field
Field field = target.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
return (T) field.get(target);
ListgetAllFields(List fields, Class type)
get All Fields
Collections.addAll(fields, type.getDeclaredFields());
if (type.getSuperclass() != null) {
    fields = getAllFields(fields, type.getSuperclass());
return fields;
ObjectgetSuperPrivateField(Object target, String fieldName)
get Super Private Field
Field field = target.getClass().getSuperclass()
        .getDeclaredField(fieldName);
field.setAccessible(true);
return field.get(target);
ObjectgetAdditionalInstanceField(Object obj, String key)
get Additional Instance Field
if (obj == null)
    throw new NullPointerException("object must not be null");
if (key == null)
    throw new NullPointerException("key must not be null");
HashMap<String, Object> objectFields;
synchronized (additionalFields) {
    objectFields = additionalFields.get(obj);
    if (objectFields == null)
...
ObjectgetAdditionalStaticField(Object obj, String key)
get Additional Static Field
return getAdditionalInstanceField(obj.getClass(), key);
booleanisBaseDateType(Field field)
is Base Date Type
Class<?> clazz = field.getType();
return clazz.equals(String.class) || clazz.equals(Integer.class)
        || clazz.equals(Byte.class) || clazz.equals(Long.class)
        || clazz.equals(Double.class) || clazz.equals(Float.class)
        || clazz.equals(Character.class)
        || clazz.equals(Short.class) || clazz.equals(Boolean.class)
        || clazz.equals(Date.class)
        || clazz.equals(java.util.Date.class)
...