Get a new instance that can access the given Field
@param f Field to be accessed
@param <C> The type of class being accessed
@return New PortableFieldAccess instance
776813
public static <C> PortableFieldAccess<C> get(Field f) {
		
		Class<?> type = (Class<?>) f.getType();
		
		if (type.isPrimitive()) {
			if (java.lang.Boolean.TYPE == type) {
				return (PortableFieldAccess<C>) new PortableBooleanFieldAccess<C>(f);
			} else if (java.lang.Byte.TYPE == type) {
				return (PortableFieldAccess<C>) new PortableByteFieldAccess<C>(f);
			} else if (java.lang.Character.TYPE == type) {
				return (PortableFieldAccess<C>) new PortableCharFieldAccess<C>(f);
			} else if (java.lang.Short.TYPE == type) {
				return (PortableFieldAccess<C>) new PortableShortFieldAccess<C>(f);
			} else if (java.lang.Integer.TYPE == type) {
				return (PortableFieldAccess<C>) new PortableIntFieldAccess<C>(f);
			} else if (java.lang.Long.TYPE == type) {
				return (PortableFieldAccess<C>) new PortableLongFieldAccess<C>(f);
			} else if (java.lang.Float.TYPE == type) {
				return (PortableFieldAccess<C>) new PortableFloatFieldAccess<C>(f);
			} else if (java.lang.Double.TYPE == type) {
				return (PortableFieldAccess<C>) new PortableDoubleFieldAccess<C>(f);
			}
		}
		return new PortableFieldAccess<C>(f);
	}
644472
public static Object getFieldInstance(List chids, Field f)
    {

        if (Set.class.isAssignableFrom(f.getType()))
        {
            Set col = new HashSet(chids);
            return col;
        }
        return chids;
    }
1066436
Object getObjectFromConstantFields(Class cls) {
		Field[] fields = cls.getFields();
		Object instance = null;
		for (Field field : fields) {
			instance = getObjectFromConstantField(cls, field);
			if(instance!=null) {
				break;
			}
		}
		return instance;
	}
277018
public static Object getValue(Object instance, String fieldName) {
      Field f = findFieldRecursively(instance.getClass(), fieldName);
      if (f == null) throw new CacheException("Could not find field named '" + fieldName + "' on instance " + instance);
      try {
         f.setAccessible(true);
         return f.get(instance);
      } catch (IllegalAccessException iae) {
         throw new CacheException("Cannot access field " + f, iae);
      }
   }
1111300
public static File assertReadable(final File f) throws FileNotFoundException {
        if (!f.exists()) {
            throw new FileNotFoundException(f.getAbsolutePath() +
                " does not exist.");
        }

        if (!f.canRead()) {
            throw new FileNotFoundException(f.getAbsolutePath() +
                " is not readable.");
        }
        
        return f;
    }
1046090
static Field field(final Class<?> klass, final String name) throws NoSuchFieldException {
        try {
            return klass.getDeclaredField(name);
        } catch (final NoSuchFieldException nsfe) {
            final Class<?> superclass = klass.getSuperclass();
            if (superclass == null) {
                throw nsfe;
            }
            return field(superclass, name);
        }
    }
243311
protected static void lookupFieldResource(javax.naming.Context context,
            Object instance, Field field, String name)
            throws NamingException, IllegalAccessException
    {

        Object lookedupResource;

        if ((name != null) && (name.length() > 0))
        {
            // TODO local or global JNDI
            lookedupResource = context.lookup(JAVA_COMP_ENV + name);
        }
        else
        {
            // TODO local or global JNDI 
            lookedupResource = context.lookup(JAVA_COMP_ENV + instance.getClass().getName() + "/" + field.getName());
        }

        boolean accessibility = field.isAccessible();
        field.setAccessible(true);
        field.set(instance, lookedupResource);
        field.setAccessible(accessibility);
    }
279067
private static Object getValue(final Object o, final Field f) {
        try {
            f.setAccessible(true);
            return f.get(o);
        } catch (final IllegalArgumentException e) {
            LOGGER.error("failure accessing field value {}", new Object[] { f.getName(), e });
        } catch (final IllegalAccessException e) {
            LOGGER.error("failure accessing field value {}", new Object[] { f.getName(), e });
        }
        return null;
    }
838387
public static Object getFieldValue(Object obj, Field field) throws UtilException {
		if (null == obj || null == field) {
			return null;
		}
		field.setAccessible(true);
		Object result = null;
		try {
			result = field.get(obj);
		} catch (IllegalAccessException e) {
			throw new UtilException(e, "IllegalAccess for {}.{}", obj.getClass(), field.getName());
		}
		return result;
	}
139569
public static Field[] getFieldsIgnoreCase(Class clazz, String name) throws NoSuchFieldException {
	Field[] fields = fStorage.getFields(clazz, name);
	if (fields != null) return fields;
	throw new NoSuchFieldException("there is no field with name " + name + " in object [" + Type.getName(clazz) + "]");
    }
824505
protected Field getField()
    {
        // make sure class was initialized
        if (!isInitialized)
        {
            /*
            first we build a graph of fields for nested fields support,
            but for best performance on non-nested fields we also keep
            the latest field separate and set a 'is nested' flag.
            */
            fieldsList = getFieldGraph(makeAccessible());
            field = (Field) fieldsList.get(fieldsList.size() - 1);
            nonNested = fieldsList.size() == 1;
            isInitialized = true;
        }
        return field;
    }
657880
private Object getFieldValue(Field field) {
        try {
            field.setAccessible(true);
            return field.get(this);
        } catch (IllegalArgumentException | IllegalAccessException e) {
            LOGGER.error("Can't access to field value", e);
            return null;
        }
    }
780034
public ASTField getField(Field field) {
        ASTAccessModifier modifier = ASTAccessModifier.getModifier(field.getModifiers());

        return new ASTClassField(field, getType(field.getType(), field.getGenericType()), modifier, getAnnotations(field));
    }
1218384
public static AnnotationTypeFieldBuilder getInstance(
            Context context, ClassDoc classDoc,
            AnnotationTypeFieldWriter writer) {
        return new AnnotationTypeFieldBuilder(context, classDoc,
                    writer, VisibleMemberMap.ANNOTATION_TYPE_FIELDS);
    }
214049
protected final Object getDataField(String name) throws NotAvailableException {
        try {
            MB dataClone = cloneDataBuilder();
            Descriptors.FieldDescriptor findFieldByName = dataClone.getDescriptorForType().findFieldByName(name);
            if (findFieldByName == null) {
                throw new NotAvailableException("Field[" + name + "] does not exist for type " + dataClone.getClass().getName());
            }
            return dataClone.getField(findFieldByName);
        } catch (Exception ex) {
            throw new NotAvailableException(name, this, ex);
        }
    }
20004
public CustomField getCustomField(FieldType field)
   {
      CustomField result = m_configMap.get(field);
      if (result == null)
      {
         result = new CustomField(field, this);
         m_configMap.put(field, result);
      }
      return result;
   }
212915
public static FieldNode getField(ClassNode classNode, String fieldName) {
        ClassNode node = classNode;
        Set<String> visited = new HashSet<String>();
        while (node != null) {
            FieldNode fn = node.getDeclaredField(fieldName);
            if (fn != null) return fn;
            ClassNode[] interfaces = node.getInterfaces();
            for (ClassNode iNode : interfaces) {
                if (visited.contains(iNode.getName())) continue;
                FieldNode ifn = getField(iNode, fieldName);
                visited.add(iNode.getName());
                if (ifn != null) return ifn;
            }
            node = node.getSuperClass();
        }
        return null;
    }