Get the read method for given field.
@param field field to get the read method for.
@return Optional of read method or empty if field has no read method
327958
public static Optional<Method> getReadMethod(Field field) {
        String fieldName = field.getName();
        Class<?> fieldClass = field.getDeclaringClass();
        String capitalizedFieldName = fieldName.substring(0, 1).toUpperCase(ENGLISH) + fieldName.substring(1);
        // try to find getProperty
        Optional<Method> getter = getPublicMethod("get" + capitalizedFieldName, fieldClass);
        if (getter.isPresent()) {
            return getter;
        }
        // try to find isProperty for boolean properties
        return getPublicMethod("is" + capitalizedFieldName, fieldClass);
    }
161572
public Optional<TypeInformation<?>> getFieldType(String fieldName) {
		if (fieldNameToIndex.containsKey(fieldName)) {
			return Optional.of(fieldTypes[fieldNameToIndex.get(fieldName)]);
		}
		return Optional.empty();
	}
1051432
private static <T> Method tryGetSetMethod(Class<T> clazz, Field field, String methodName) {

        try {
            return clazz.getDeclaredMethod(methodName, field.getType());
        } catch (Exception e) {

            return null;
        }

    }
993017
public static Method getGetterMethod(Class<?> clazz, Field field) {
        return getMethod(clazz, getGetterMethodName(field));
    }
193429
def _read_field(self):
        '''
        
        '''
        ftype = self._input[self._pos]
        self._pos += 1

        reader = self.field_type_map.get(ftype)
        if reader:
            return reader(self)

        raise Reader.FieldError('Unknown field type %s', ftype)
296863
public void getStaticField(VariableElement field) throws IOException
    {
        if (!field.getModifiers().contains(Modifier.STATIC))
        {
            throw new IllegalArgumentException(field+" is not static");
        }
        int index = subClass.resolveFieldIndex(field);
        getstatic(index);
    }
504305
public Optional<String> getFieldName(int fieldIndex) {
		if (fieldIndex < 0 || fieldIndex >= fieldNames.length) {
			return Optional.empty();
		}
		return Optional.of(fieldNames[fieldIndex]);
	}
408520
public Object get(String field) {
        if (target == null) {
            return null;
        }

        return get(field, field, target);
    }
1074129
public static FieldMarshaller getFieldMarshaller (Field field)
    {
        if (_marshallers == null) {
            // multiple threads may attempt to create the stock marshallers, but they'll just do
            // extra work and _marshallers will only ever contain a fully populated table
            _marshallers = createMarshallers();
        }

        // if necessary (we're running in a sandbox), look for custom field accessors
        if (useFieldAccessors()) {
            Method reader = null, writer = null;
            try {
                reader = field.getDeclaringClass().getMethod(
                    getReaderMethodName(field.getName()), READER_ARGS);
            } catch (NoSuchMethodException nsme) {
                // no problem
            }
            try {
                writer = field.getDeclaringClass().getMethod(
                    getWriterMethodName(field.getName()), WRITER_ARGS);
            } catch (NoSuchMethodException nsme) {
                // no problem
            }
            if (reader != null && writer != null) {
                return new MethodFieldMarshaller(reader, writer);
            }
            if ((reader == null && writer != null) || (writer == null && reader != null)) {
                log.warning("Class contains one but not both custom field reader and writer",
                            "class", field.getDeclaringClass().getName(), "field", field.getName(),
                            "reader", reader, "writer", writer);
                // fall through to using reflection on the fields...
            }
        }

        Class<?> ftype = field.getType();

        // use the intern marshaller for pooled strings
        if (ftype == String.class && field.isAnnotationPresent(Intern.class)) {
            return _internMarshaller;
        }

        // if we have an exact match, use that
        FieldMarshaller fm = _marshallers.get(ftype);
        if (fm == null) {
            Class<?> collClass = Streamer.getCollectionClass(ftype);
            if (collClass != null && !collClass.equals(ftype)) {
                log.warning("Specific field types are discouraged " +
                    "for Iterables/Collections and Maps. The implementation type may not be " +
                    "recreated on the other side.",
                    "class", field.getDeclaringClass(), "field", field.getName(),
                    "type", ftype, "shouldBe", collClass);
                fm = _marshallers.get(collClass);
            }

            // otherwise if the class is a pure interface or streamable,
            // use the streamable marshaller
            if (fm == null && (ftype.isInterface() || Streamer.isStreamable(ftype))) {
                fm = _marshallers.get(Streamable.class);
            }
        }

        return fm;
    }
416937
public static PropertyMetadata getPropertyMetadata(Field field) {
    Property property = field.getAnnotation(Property.class);
    // For fields that have @Property annotation, we expect both setter and
    // getter methods. For all other fields, we only treat them as
    // persistable if we find valid getter and setter methods.
    try {
      PropertyMetadata propertyMetadata = new PropertyMetadata(field);
      return propertyMetadata;
    } catch (NoAccessorMethodException | NoMutatorMethodException exp) {
      if (property != null) {
        throw exp;
      }
    }
    return null;
  }
357823
static JMethod getter(FieldOutline fieldOutline) {
        final JDefinedClass theClass = fieldOutline.parent().implClass;
        final String publicName = fieldOutline.getPropertyInfo().getName(true);
        final JMethod getgetter = theClass.getMethod("get" + publicName, NONE);
        if (getgetter != null) {
            return getgetter;
        } else {
            final JMethod isgetter = theClass
                    .getMethod("is" + publicName, NONE);
            if (isgetter != null) {
                return isgetter;
            } else {
                return null;
            }
        }
    }
357190
public static Object getFieldValue(Field field, Object obj) {
    try {
      return field.get(obj);
    } catch (IllegalAccessException e) {
      throw new IllegalArgumentException(e);
    }
  }
994316
public String getValue(final String field)
    {
        FieldValue fieldValue = Iterables.find
        (
            fieldValues,
            new Predicate<FieldValue>()
            {
                @Override
                public boolean apply(FieldValue fv)
                {
                    return fv.getField().equals(field);
                }
            },
            null
        );
        return (fieldValue != null) ? fieldValue.getValue() : null;
    }
756702
@Override
    public Object getField(FieldDescriptor field) {
        checkFieldDescriptor(field);
        Object result = field.getNumber() == 1 ? getKey() : getValue();
        // Convert enums to EnumValueDescriptor.
        if (field.getType() == FieldDescriptor.Type.ENUM) {
            result = field.getEnumType().findValueByNumberCreatingIfUnknown((java.lang.Integer) result);
        }
        return result;
    }
1198612
@Nullable
  public Object get(@Nonnull String field) {
    return get(FieldPath.fromDotSeparatedString(field));
  }
1049656
def _get_field_method(self, tp):
        """"""
        method = self.field_constructor.get(tp)
        if method and hasattr(self, method.__name__):
            return getattr(self, method.__name__)
        return method
309853
public static Object readValueFromBeanField(Object entityBean, String fieldName) {
		Method readMethod = ClassCacheUtils.getClassFieldReadMethod(entityBean.getClass(), fieldName);
		if (readMethod == null) {
			throw new DialectException(
					"No mapping found for field '" + fieldName + "' in '" + entityBean.getClass() + "'");
		} else
			try {
				return readMethod.invoke(entityBean);
			} catch (Exception e) {
				throw new DialectException(e);
			}
	}