Finds the first Field with given field name in the Class and in its super classes.

@param type      The Class type
@param fieldName The field name to get
@return an {@code Optional}. Use isPresent() to find out if the field name was found.
160025
public static Optional<Field> getField(Class<?> type, final String fieldName) {
        Optional<Field> field = Iterables.tryFind(newArrayList(type.getDeclaredFields()), havingFieldName(fieldName));

        if (!field.isPresent() && type.getSuperclass() != null){
            field = getField(type.getSuperclass(), fieldName);
        }

        return field;
    }
150196
public static <T> Class<FieldParser<T>> getParserForType(Class<T> type) {
		Class<? extends FieldParser<?>> parser = PARSERS.get(type);
		if (parser == null) {
			return null;
		} else {
			@SuppressWarnings("unchecked")
			Class<FieldParser<T>> typedParser = (Class<FieldParser<T>>) parser;
			return typedParser;
		}
	}
1080525
public FieldInfo getFieldInfo(final String fieldName) {
        for(FieldInfo item : fieldInfos) {
            if(item.getFieldName().equals(fieldName)) {
                return item;
            }
        }
        
        return null;
    }
721773
public CachedField getField (String fieldName) {
		for (CachedField cachedField : cachedFields.fields)
			if (cachedField.name.equals(fieldName)) return cachedField;
		throw new IllegalArgumentException("Field \"" + fieldName + "\" not found on class: " + type.getName());
	}
294952
public Field getField(String name) {
    FieldInfo fieldInfo = getFieldInfo(name);
    return fieldInfo == null ? null : fieldInfo.getField();
  }
1161044
private static FieldType getPlaceholder(final Class<?> type, final int fieldID)
   {
      return new FieldType()
      {
         @Override public FieldTypeClass getFieldTypeClass()
         {
            return FieldTypeClass.UNKNOWN;
         }

         @Override public String name()
         {
            return "UNKNOWN";
         }

         @Override public int getValue()
         {
            return fieldID;
         }

         @Override public String getName()
         {
            return "Unknown " + (type == null ? "" : type.getSimpleName() + "(" + fieldID + ")");
         }

         @Override public String getName(Locale locale)
         {
            return getName();
         }

         @Override public DataType getDataType()
         {
            return null;
         }

         @Override public FieldType getUnitsType()
         {
            return null;
         }

         @Override public String toString()
         {
            return getName();
         }
      };
   }
577639
public <T> Map<String, T> findByTypeWithName(Class<T> type) {
        return BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, type);
    }
1147780
private Map<String, Field> getAllFields(Class<?> type) {
        Map<String, Field> fields = new HashMap<String, Field>();
        for (Class<?> c = type; c != null; c = c.getSuperclass()) {
            for(Field f : c.getDeclaredFields()) {
                fields.put(f.getName(), f);
            }
        }
        return fields;
    }
591300
@Override
	public <T> Optional<T> findFirst(final Class<T> type) {
		try (Stream<T> stream = stream(new EntityResultSetConverter<>(type, new PropertyMapperManager()))) {
			return stream.findFirst();
		}
	}
220238
public Object getFieldDefaultValue(TypeElement type, String name) {
		return this.defaultValues.computeIfAbsent(type, this::resolveFieldValues)
				.get(name);
	}
1121629
public <T> Map<String, T> findByTypeWithName(Class<T> type) {
        return applicationContext.getBeansOfType(type);
    }
103801
public static String getFieldNameByType(Class<?> classType, Class<?> fieldType) {
		Field[] declaredFields = classType.getDeclaredFields();
		for (Field field : declaredFields) {
			if (field.getType().isAssignableFrom(fieldType)) {
				return field.getName();
			}
		}
		if (classType.getSuperclass() != null) {
			return getFieldNameByType(classType.getSuperclass(), fieldType);
		}
		return null;
	}
1342007
public JavaField getField(String name)
  {
    ArrayList<JavaField> fieldList = getFieldList();
    
    for (int i = 0; i < fieldList.size(); i++) {
      JavaField field = fieldList.get(i);

      if (field.getName().equals(name))
        return field;
    }

    return null;
  }
333508
public Class<?> getActualFieldType(final String field) {
        
        final Object fieldValue = getFieldValue(field);
        return fieldValue == null ? null : fieldValue.getClass();
        
    }
426303
public <T> FieldFormatter<T> findFieldFormatter(final String field, final Class<T> fieldType) {
        String fieldPath = buildFieldPath(field);
        return fieldFormatterRegistry.findFormatter(fieldPath, fieldType);
    }
122648
public static void setField(Object instance, Class<?> type, String fieldName, Object fieldValue) {
		try {
			final Field field = type.getDeclaredField(fieldName);
			field.setAccessible(true);
			field.set(instance, fieldValue);
		} catch (Exception exception) {
			throw new Error(exception);
		}
	}
1087004
public boolean hasField(@NonNull String fieldName) {
      return ClassDescriptorCache.getInstance()
                                 .getClassDescriptor(clazz)
                                 .getFields(accessAll)
                                 .stream()
                                 .anyMatch(f -> f.getName().equals(fieldName));
   }