Returns a list of {@link AnnotatedValueResolver} which is constructed with the specified
{@link Field}, {@code pathParams} and {@code objectResolvers}.
976985
static Optional<AnnotatedValueResolver> ofBeanField(Field field, Set<String> pathParams,
                                                        List<RequestObjectResolver> objectResolvers) {
        // 'Field' is only used for converting a bean.
        // So we always need to pass 'implicitRequestObjectAnnotation' as false.
        return of(field, field, field.getType(), pathParams, objectResolvers, false);
    }
44552
protected List<Field> getFields(Class<?> clazz) {
        List<Field> fields = new ArrayList<Field>();

        while (clazz != null && !isBoundaryClass(clazz)) {
            for (Field field : clazz.getDeclaredFields()) {
                if (!field.isAnnotationPresent(Inject.class)) {
                    continue;
                }
                fields.add(field);
            }
            clazz = clazz.getSuperclass();
        }
        return fields;
    }
612148
public static <Param> PathParamSerializer<List<Param>> list(String name,
                                                                Function<PSequence<String>, Param> deserialize,
                                                                Function<Param, PSequence<String>> serialize) {

        return new NamedPathParamSerializer<List<Param>>("List(" + name + ")") {
            @Override
            public PSequence<String> serialize(List<Param> parameter) {
                List<String> serializedParams =
                    serializeCollection(parameter, serialize)
                        .collect(Collectors.toList());
                return TreePVector.from(serializedParams);
            }

            @Override
            public List<Param> deserialize(PSequence<String> parameters) {
                return deserializeCollection(parameters, deserialize).collect(Collectors.toList());
            }
        };
    }
433092
public List<FieldRef> getFields() {
        Map<String,FieldRef> fields = new LinkedHashMap<String,FieldRef>();
        for (Klass<?> k = this; k!=null; k=k.getSuperClass()) {
            for (FieldRef f : k.getDeclaredFields()) {
                String name = f.getName();
                if (!fields.containsKey(name) && f.isRoutable()) {
                    fields.put(name,f);
                }
            }
        }

        return new ArrayList<FieldRef>(fields.values());
    }
807482
public static BeanPathProperties parsePathProperties() {
        Object pathProperties = Requests.getProperty(PATH_PROPS_PARSED);
        if (pathProperties == null) {
            String fields = parseQueryFields();
            if (fields != null) {
                pathProperties = BeanPathProperties.parse(fields);
                Requests.setProperty(PATH_PROPS_PARSED, pathProperties);
            } else {
                Requests.setProperty(PATH_PROPS_PARSED, false);
            }
        } else if (pathProperties.equals(false)) {
            return null;
        }
        return (BeanPathProperties) pathProperties;
    }
1087526
private List<Field> getFields(Class given) {
		Field[] fs = given.getDeclaredFields();
		return new ArrayList<>(Arrays.asList(fs));
	}
721450
@SuppressWarnings({"unchecked", "rawtypes"})
    public List<E> getValueAsList() {

        final Object fieldValue = getValue();
        final Class<?> fieldType = getType();

        if(Collection.class.isAssignableFrom(fieldType)) {
            final Collection<Object> value = (fieldValue == null ? new ArrayList<Object>() : (Collection<Object>) fieldValue);
            final List<Object> list = Utils.convertCollectionToList(value);
            return (List)list;

        } else if(fieldType.isArray()) {
            Class<?> componentType = fieldType.getComponentType();
            final List<Object> list = Utils.asList(fieldValue, componentType);
            return (List)list;

        } else {
            throw new IllegalStateException(MessageBuilder.create("validation.notSupportType")
                    .var("property", getFieldPath())
                    .varWithClass("type", fieldType)
                    .format());
        }

    }
1205819
private List<String> getFieldPath(String field) {
        String[] paths = field.split("(?<!\\\\)\\.");
        ImmutableList.Builder<String> fields = ImmutableList.builder();
        for (String path : paths) {
            fields.add(path.replaceAll("\\\\\\.", ".").replaceAll("\\\\\\\\", "\\\\"));
        }
        return fields.build();
    }
454300
private List<Field> getAllFields(List<Field> fields, Class<?> clazz) {
    // TODO consider caching the results of this.
    checkNotNull(fields);
    checkNotNull(clazz);

    fields.addAll(Arrays.asList(clazz.getDeclaredFields()));

    if (clazz.getSuperclass() != null) {
      getAllFields(fields, clazz.getSuperclass());
    }

    return Collections.unmodifiableList(fields);
  }
537981
static List<AnnotatedValueResolver> ofServiceMethod(Method method, Set<String> pathParams,
                                                        List<RequestObjectResolver> objectResolvers) {
        return of(method, pathParams, objectResolvers, true, true);
    }
700578
public List<Plugin.Factory.UsingReflection.ArgumentResolver> makeArgumentResolvers() {
        if (arguments == null) {
            return Collections.emptyList();
        } else {
            List<Plugin.Factory.UsingReflection.ArgumentResolver> argumentResolvers = new ArrayList<Plugin.Factory.UsingReflection.ArgumentResolver>();
            for (PluginArgument argument : arguments) {
                argumentResolvers.add(argument.toArgumentResolver());
            }
            return argumentResolvers;
        }
    }
1040450
private Field[] fields(Class<?> clazz)
    {

        Map<String, Field> fields = new HashMap<String, Field>();
        do
        {
            for (Field field : clazz.getDeclaredFields())
            {
                if (!fields.containsKey(field.getName()))
                {
                    fields.put(field.getName(), field);
                }
            }
            clazz = clazz.getSuperclass();
        }
        while (clazz != Object.class);

        return fields.values().toArray(new Field[fields.size()]);

    }
774230
public static List<Field> getValidFields(final Field[] fields, final boolean returnFinalFields) {
        final List<Field> validFields = new ArrayList<Field>();
        // we ignore static and final fields
        for (final Field field : fields) {
            if (!Modifier.isStatic(field.getModifiers()) && (returnFinalFields || !Modifier.isFinal(field.getModifiers()))) {
                validFields.add(field);
            }
        }
        return validFields;
    }
177310
public List<BeanSpec> fields($.Predicate<Field> filter) {
        List<BeanSpec> retVal = new ArrayList<>();
        BeanSpec current = this;
        Class<?> rawType = rawType();
        if ($.isSimpleType(rawType)) {
            return C.list();
        }
        Type[] typeDeclarations = rawType.getTypeParameters();
        Map<String, Class> typeImplLookup = null;
        while (null != current && current.isNotObject()) {
            Type[] fieldTypeParams = null;
            Type[] classTypeParams;
            Map<String, Type> typeParamsMapping = new HashMap<>();
            for (Field field : current.rawType().getDeclaredFields()) {
                if (!filter.test(field)) {
                    continue;
                }
                Type fieldGenericType = field.getGenericType();
                if (fieldGenericType instanceof ParameterizedType) {
                    if (null == fieldTypeParams) {
                        fieldTypeParams = ((ParameterizedType) fieldGenericType).getActualTypeArguments();
                        if (fieldTypeParams != null && fieldTypeParams.length > 0) {
                            classTypeParams = current.rawType().getTypeParameters();
                            if (classTypeParams != null && classTypeParams.length > 0) {
                                List<Type> classTypeImpls = current.typeParams();
                                for (int i = 0; i < classTypeParams.length; ++i) {
                                    if (i >= classTypeImpls.size()) {
                                        break;
                                    }
                                    Type classTypeParam = classTypeParams[i];
                                    if (classTypeParam instanceof TypeVariable) {
                                        typeParamsMapping.put(((TypeVariable) classTypeParam).getName(), classTypeImpls.get(i));
                                    }
                                }
                            }
                        }
                    }
                    boolean updated = false;
                    if (!typeParamsMapping.isEmpty()) {
                        for (int i = 0; i < fieldTypeParams.length; ++i) {
                            Type typeArg = fieldTypeParams[i];
                            if (typeArg instanceof TypeVariable) {
                                String name = ((TypeVariable) typeArg).getName();
                                Type typeImpl = typeParamsMapping.get(name);
                                if (null != typeImpl && $.ne(typeImpl, typeArg)) {
                                    updated = true;
                                    fieldTypeParams[i] = typeImpl;
                                }
                            }
                        }
                    }
                    if (updated) {
                        fieldGenericType = new ParameterizedTypeImpl(fieldTypeParams, ((ParameterizedType) fieldGenericType).getOwnerType(), ((ParameterizedType) fieldGenericType).getRawType());
                    }
                    retVal.add(beanSpecOf(field, fieldGenericType));
                } else if (fieldGenericType instanceof TypeVariable) {
                    if (null == typeImplLookup) {
                        typeImplLookup = Generics.buildTypeParamImplLookup(this.rawType);
                        if (null != fieldTypeImplLookup) {
                            typeImplLookup.putAll(fieldTypeImplLookup);
                        }
                    }
                    TypeVariable fieldType = (TypeVariable) fieldGenericType;
                    Class clazz = typeImplLookup.get(fieldType.getName());
                    if (null != clazz) {
                        retVal.add(of(field, fieldGenericType, injector, typeImplLookup));
                    } else {
                        boolean added = false;
                        for (int i = typeDeclarations.length - 1; i >= 0; --i) {
                            if (typeDeclarations[i].equals(fieldGenericType)) {
                                fieldGenericType = current.typeParams().get(i);
                                retVal.add(of(field, fieldGenericType, injector, typeImplLookup));
                                added = true;
                                break;
                            }
                        }
                        if (!added) {
                            throw new InjectException("Cannot infer field type: " + field);
                        }
                    }
                } else if (fieldGenericType instanceof GenericArrayType) {
                    if (null == typeImplLookup) {
                        typeImplLookup = Generics.buildTypeParamImplLookup(this.rawType);
                    }
                    retVal.add(of(field, injector(), typeImplLookup));
                } else {
                    retVal.add(of(field, injector()));
                }
            }
            current = current.parent();
            if (null != current) {
                typeDeclarations = current.rawType.getTypeParameters();
            }
        }
        return retVal;
    }
538513
private static List<Field> getServiceFields(Object object)
    {
        final List<Field> toInject = new ArrayList<>();
        Class<?> clazz = object.getClass();
        while (clazz != null)
        {
            final Field[] fields = clazz.getDeclaredFields();
            final int length = fields.length;
            for (int i = 0; i < length; i++)
            {
                final Field field = fields[i];
                if (field.isAnnotationPresent(FeatureGet.class))
                {
                    toInject.add(field);
                }
            }
            clazz = clazz.getSuperclass();
        }
        return toInject;
    }
1144667
public static FieldInfo of(Field field) {
    if (field == null) {
      return null;
    }
    synchronized (CACHE) {
      FieldInfo fieldInfo = CACHE.get(field);
      boolean isEnumContant = field.isEnumConstant();
      if (fieldInfo == null && (isEnumContant || !Modifier.isStatic(field.getModifiers()))) {
        String fieldName;
        if (isEnumContant) {
          // check for @Value annotation
          Value value = field.getAnnotation(Value.class);
          if (value != null) {
            fieldName = value.value();
          } else {
            // check for @NullValue annotation
            NullValue nullValue = field.getAnnotation(NullValue.class);
            if (nullValue != null) {
              fieldName = null;
            } else {
              // else ignore
              return null;
            }
          }
        } else {
          // check for @Key annotation
          Key key = field.getAnnotation(Key.class);
          if (key == null) {
            // else ignore
            return null;
          }
          fieldName = key.value();
          field.setAccessible(true);
        }
        if ("##default".equals(fieldName)) {
          fieldName = field.getName();
        }
        fieldInfo = new FieldInfo(field, fieldName);
        CACHE.put(field, fieldInfo);
      }
      return fieldInfo;
    }
  }
16583
public static List<Field> getAllFields(Class<?> clazz) {
        final List<Field> ret = new ArrayList<>();
        do {
            ret.addAll(Arrays.asList(clazz.getDeclaredFields()));
            clazz = clazz.getSuperclass();
        } while (clazz != null);
        return ret;
    }