Generates the getter method and optionally the primitive getter.
@param field The reflection field object.
764419
private void generateGetter(Field field) {
    if (isPrivate) {
      invokeReflection(getMethod(Object.class, "get", Object.class), getterSignature());
    } else {
      directGetter(field);
    }

    if (field.getType().isPrimitive()) {
      primitiveGetter(field);
    }
  }
752924
public Object getFieldActualValue(final String field) {
        final String fieldPath = buildFieldPath(field);
        return propertyValueNavigator.getProperty(target, fieldPath);
    }
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;
        }

    }
699173
private Object generateEnumerateObject(final Field field,
                                           final Map<Field, Long> enumerateMap) {
        final Long currentEnumerateValue = enumerateMap.get(field);
        Object objValue = BasicCastUtils.castToNumber(currentEnumerateValue, field.getType());

        // Increment numerate number for generated field
        enumerateMap.computeIfPresent(field, (k, v) -> v + 1);
        return objValue;
    }
667107
public void getField(VariableElement field) throws IOException
    {
        if (field.getModifiers().contains(Modifier.STATIC))
        {
            throw new IllegalArgumentException(field+" is static");
        }
        int index = subClass.resolveFieldIndex(field);
        getfield(index);
    }
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;
    }
1223064
private static <T> Method getGetter(Class<T> clazz, Field f){
		String getterName = "get" + StringUtils.capitalize(f.getName());
		Method getter = null;
		try {
			getter = clazz.getMethod(getterName);
		} catch (Exception e) {
			logger.debug(getterName + " doesn't exist!",e);
		}
		return getter;
	}
682812
public static Method findGetMethod(Field field, DatabaseType databaseType, boolean throwExceptions)
			throws IllegalArgumentException {
		Method fieldGetMethod = findMethodFromNames(field, true, throwExceptions,
				methodFromField(field, "get", databaseType, true), methodFromField(field, "get", databaseType, false),
				methodFromField(field, "is", databaseType, true), methodFromField(field, "is", databaseType, false));
		if (fieldGetMethod == null) {
			return null;
		}
		if (fieldGetMethod.getReturnType() != field.getType()) {
			if (throwExceptions) {
				throw new IllegalArgumentException("Return type of get method " + fieldGetMethod.getName()
						+ " does not return " + field.getType());
			} else {
				return null;
			}
		}
		return fieldGetMethod;
	}
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;
            }
        }
    }
1159665
public static boolean serializeField(String keyName, Field field, Method getter) {
        log.trace("serializeField - keyName: {} field: {} method: {}", new Object[] { keyName, field, getter });
        // if "field" is a class or is transient, skip it
        if ("class".equals(keyName)) {
            return false;
        }
        if (field != null) {
            if (Modifier.isTransient(field.getModifiers())) {
                log.trace("Skipping {} because its transient", keyName);
                return false;
            } else if (field.isAnnotationPresent(DontSerialize.class)) {
                log.trace("Skipping {} because its marked with @DontSerialize", keyName);
                return false;
            }
        }
        if (getter != null && getter.isAnnotationPresent(DontSerialize.class)) {
            log.trace("Skipping {} because its marked with @DontSerialize", keyName);
            return false;
        }
        log.trace("Serialize field: {}", field);
        return true;
    }
621775
private PropDesc createProp(Field field) {
		final String fieldName = field.getName();
		final Class<?> fieldType = field.getType();
		final boolean isBooeanField = BooleanUtil.isBoolean(fieldType);

		Method getter = null;
		Method setter = null;

		String methodName;
		Class<?>[] parameterTypes;
		for (Method method : ReflectUtil.getMethods(this.beanClass)) {
			parameterTypes = method.getParameterTypes();
			if (parameterTypes.length > 1) {
				// 多于1个参数说明非Getter或Setter
				continue;
			}

			methodName = method.getName();
			if (parameterTypes.length == 0) {
				// 无参数，可能为Getter方法
				if (isMatchGetter(methodName, fieldName, isBooeanField)) {
					// 方法名与字段名匹配，则为Getter方法
					getter = method;
				}
			} else if (isMatchSetter(methodName, fieldName, isBooeanField)) {
				// 只有一个参数的情况下方法名与字段名对应匹配，则为Setter方法
				setter = method;
			}
			if (null != getter && null != setter) {
				// 如果Getter和Setter方法都找到了，不再继续寻找
				break;
			}
		}
		return new PropDesc(field, getter, setter);
	}
26882
public static String javaRepeatedEnumValueGetterByIndexName(Field field) {
        if (field.isRepeated()) {
            return GETTER_PREFIX + Formatter.toPascalCase(field.getName()) + VALUE;
        }
        throw new IllegalArgumentException(field.toString());
    }
199330
public static String mapGetByKeyMethodName(Field field) {
        if (field.isMap()) {
            return GETTER_PREFIX + Formatter.toPascalCase(field.getName());
        }
        throw new IllegalArgumentException(field.toString());
    }
839375
public int getRawFieldData(Convert field)
    {
        if (this.getKey() == null)
            this.setKey(field.getFieldName());
        Object objValue = this.get();
        if ((objValue == null) || (objValue.getClass() == field.getField().getDataClass()))
            return field.setData(objValue); // Should call here
        else
            return field.setString(this.getString());
    }
954076
public static Object getValue(Field field, Object object) {
		String fieldName = field.getName();
		String setMethodName = "get" + firstLetterUpperCase(fieldName);
		Method method = null;
		try {
			method = object.getClass().getMethod(setMethodName);
		} catch (Exception e) {
		}
		
		if(method != null) {
			try {
				return method.invoke(object);
			} catch (Exception e) {
				LOGGER.error("method invoke", e);
			}
		}
		
		field.setAccessible(true);
		try {
			return field.get(object);
		} catch (Exception e) {
			LOGGER.error("method invoke", e);
			return null;
		}
	}
849172
private Method[] settersMethodForField(Field field) {
    List<Method> methods = new ArrayList<>();
    for (Method method : field.getDeclaringClass().getDeclaredMethods()) {
      if (Ascii.toLowerCase(method.getName()).equals("set" + Ascii.toLowerCase(field.getName()))
          && method.getParameterTypes().length == 1) {
        methods.add(method);
      }
    }
    return methods.toArray(new Method[0]);
  }
960224
public PropertyType getPropertyType(String field) {
        if(propertyTypes==null)
            propertyTypes = buildPropertyTypes(clazz);
        return propertyTypes.get(field);
    }