Android Field Get getAdditionalInstanceField(Object obj, String key)

Here you can find the source of getAdditionalInstanceField(Object obj, String key)

Description

get Additional Instance Field

Declaration

public static Object getAdditionalInstanceField(Object obj, String key) 

Method Source Code

//package com.java2s;

import java.util.HashMap;

import java.util.WeakHashMap;

public class Main {
    private static final WeakHashMap<Object, HashMap<String, Object>> additionalFields = new WeakHashMap<Object, HashMap<String, Object>>();

    public static Object getAdditionalInstanceField(Object obj, String key) {
        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)
                return null;
        }//from  w  w  w  .j a v a2 s . c o m

        synchronized (objectFields) {
            return objectFields.get(key);
        }
    }
}

Related

  1. getPrivateField(Object target, String fieldName)
  2. getPrivateField(Object target, String fieldName)
  3. getPrivateField(Object target, String fieldName, Class type)
  4. getAllFields(List fields, Class type)
  5. getSuperPrivateField(Object target, String fieldName)
  6. getAdditionalStaticField(Object obj, String key)
  7. isBaseDateType(Field field)