Gets the value of the field. This is an alternative to invoking a get
method.

@param fieldName
Name of the field to get
@param mojo
Mojo
@return Value of the field
@throws Exception
If getting the field value using relection goes wrong
556578
protected static Object getField(String fieldName, Object mojo) throws Exception {
        Field field = null;
        try {
            field = mojo.getClass().getDeclaredField(fieldName);
        } catch (NoSuchFieldException ex) {
            // Ignore exception and try superclass.
            field = mojo.getClass().getSuperclass().getDeclaredField(fieldName);
        }
        field.setAccessible(true);
        return field.get(mojo);
    }
801714
public String getString(final String fieldName) {
    try {
      return _jsonObject.getString(fieldName);
    } catch (JSONException ex) {
      throw new RuntimeException("Cannot find field", ex);
    }
  }
881767
public static String getFieldValue(ODocument document, String fieldname) {
        return (String) document.field(fieldname);
    }
1105650
public int getIndex(String name) {
    Integer index = nameIndex.get(name);
    if (index == null) {
      throw new IllegalArgumentException("Field with name '" + name + "' was not found");
    }
    return index;
  }
123785
public Attribute<T, Serializable> getAttribute(String fieldname) {
        if (fieldname == null) return null;
        return this.attributeMap.get(fieldname);
    }
182736
public Object get(String fieldName) throws IOException {
    Object value = getValueMarshaller(fieldName).getJavaObject(struct);
    LOG.debug("Fetched {}={}", fieldName, value);
    return value;
  }
987879
public static Field getField(String fieldName, Object object) {
    return getField(fieldName, object.getClass());
  }
241657
public static Object getFieldValue(Object object, String fieldName) throws NoSuchFieldException {
        Field field = getDeclaredField(object, fieldName);
        if (!field.isAccessible()) {
            field.setAccessible(true);
        }

        Object result = null;
        try {
            result = field.get(object);
        } catch (IllegalAccessException e) {
            logger.error("不可能抛出的异常{}", e.getMessage());
        }
        return result;
    }
52402
@Override
    public <T> T get(String fieldName)
    {
        switch (fieldName.toLowerCase()) {
            case FIELD_REPOSITORY:
                return (T) getRepository();
            case FIELD_ID:
                return (T) getId().getId();
            case FIELD_VERSION:
                return (T) getId().getVersion();
            case FIELD_FEATURE:
            case FIELD_FEATURES:
                return (T) ExtensionIdConverter.toStringList(getExtensionFeatures());
            case FIELD_EXTENSIONFEATURE:
            case FIELD_EXTENSIONFEATURES:
                return (T) getExtensionFeatures();
            case FIELD_SUMMARY:
                return (T) getSummary();
            case FIELD_DESCRIPTION:
                return (T) getDescription();
            case FIELD_AUTHOR:
            case FIELD_AUTHORS:
                return (T) getAuthors();
            case FIELD_CATEGORY:
                return (T) getCategory();
            case FIELD_LICENSE:
            case FIELD_LICENSES:
                return (T) getLicenses();
            case FIELD_NAME:
                return (T) getName();
            case FIELD_TYPE:
                return (T) getType();
            case FIELD_WEBSITE:
                return (T) getWebSite();
            case FIELD_NAMESPACES:
            case FIELD_ALLOWEDNAMESPACE:
            case FIELD_ALLOWEDNAMESPACES:
                return (T) getAllowedNamespaces();
            case FIELD_SCM:
                return (T) getScm();
            case FIELD_REPOSITORIES:
                return (T) getRepositories();
            case FIELD_PROPERTIES:
                return (T) getProperties();

            default:
                // Unknown field, probably a property
                return getProperty(fieldName);
        }
    }
837739
public static Field getField(Class<?> clazz, String fieldName)
      throws NoSuchFieldException {
    if (clazz == Object.class) {
      return null;
    }
    try {
      Field field = clazz.getDeclaredField(fieldName);
      return field;
    } catch (NoSuchFieldException e) {
      return getField(clazz.getSuperclass(), fieldName);
    }
  }
15563
public static Object getFieldValue(Object object, String fieldName) {
        try {
            return getDeclaredFieldInHierarchy(object.getClass(), fieldName).get(object);
        } catch (IllegalArgumentException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }
641088
public Object getField(Object o, String fieldName) {
        if (o == null) {
            throw new IllegalArgumentException("No object to get from provided");
        }
        Field field = findField(o, fieldName);
        if (field == null) {
            throw new IllegalArgumentException(o.getClass() + " does not have a field " + fieldName);
        } else {
            if (!field.isAccessible()) {
                field.setAccessible(true);
            }
            try {
                return field.get(o);
            } catch (IllegalAccessException e) {
                throw new IllegalArgumentException("Unable to get " + fieldName, e);
            }
        }
    }
440558
public <T> T getField(String fieldName, Class<T> clazz) {
        return DPathUtils.getValue(fieldData, fieldName, clazz);
    }
319533
public Object getFieldValue(final String field) {
        
        final FieldError error = getFirstFieldError(field).orElse(null);
        if(error != null && !error.isConversionFailure()) {
            return error.getRejectedValue();
        } else {
            return getFieldActualValue(field);
        }
        
    }
1250820
private function getField($thisClass, $fieldName)
    {
        $refClazz = new ReflectionObject($thisClass);
        if (!$refClazz->hasProperty($fieldName)) {
            throw new Exception("Invalid field : $fieldName");
        }

        return $refClazz->getProperty($fieldName);
    }
960490
private static String[] getObjValues(Object source, String... fieldnames) throws Exception {
        String[] results = new String[fieldnames.length];
        Field field;
        String value;
        Object obj;
        for (int i = 0; i < fieldnames.length; i++) {
            field = FieldUtil.getField(source, fieldnames[i]);
            if (field == null) {
                continue;
            }
            obj = field.get(source);
            if (obj == null) {
                value = "";
            } else if (obj instanceof Date) {
                value = DateUtil.smartFormat((Date) obj);
            } else {
                value = String.valueOf(obj);
            }
            results[i] = value;
        }
        return results;
    }
476513
public Object getFieldValue(final Object instance) {
        try {
            return field.get(instance);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }