Extract generic type from the list field.

@param field the list field to inject
@return the role of the components in the list
@since 4.0M1 it's useless
775167
@Deprecated
    protected Class<?> getGenericRole(Field field)
    {
        Type type = field.getGenericType();

        if (type instanceof ParameterizedType) {
            ParameterizedType pType = (ParameterizedType) type;
            Type[] types = pType.getActualTypeArguments();
            if (types.length > 0 && types[types.length - 1] instanceof Class) {
                return (Class) types[types.length - 1];
            }
        }

        return null;
    }
812610
function analyzeField (field) {
  var obj = {}
  var namedType = field.type
  obj.name = field.name
  obj.isDeprecated = field.isDeprecated
  obj.deprecationReason = field.deprecationReason
  obj.defaultValue = field.defaultValue
  if (namedType.kind === 'NON_NULL') {
    obj.isRequired = true
    namedType = namedType.ofType
  } else {
    obj.isRequired = false
  }
  if (namedType.kind === 'LIST') {
    obj.isList = true
    namedType = namedType.ofType
  } else {
    obj.isList = field.type.kind === 'LIST'
  }
  if (namedType.kind === 'NON_NULL') {
    obj.isNestedRequired = true
    namedType = namedType.ofType
  } else {
    obj.isNestedRequired = false
  }
  obj.type = namedType.name
  obj.isUnionType = namedType.kind === 'UNION'
  obj.isObjectType = namedType.kind === 'OBJECT'
  obj.isEnumType = namedType.kind === 'ENUM'
  obj.isInterfaceType = namedType.kind === 'INTERFACE'
  obj.isInputType = namedType.kind === 'INPUT_OBJECT'
  return obj
}
20004
public CustomField getCustomField(FieldType field)
   {
      CustomField result = m_configMap.get(field);
      if (result == null)
      {
         result = new CustomField(field, this);
         m_configMap.put(field, result);
      }
      return result;
   }
208530
public static Type getPropertyType(Class<?> beanClass, String field) {
        try {
            return INSTANCE.findPropertyType(beanClass, field);
        } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
            throw handleReflectionException(beanClass, field, e);
        }
    }
1227709
private static Fields toFieldEnum(Field field) {
        Class<?> clazz = field.getType();
        String name = clazz.getSimpleName().toLowerCase();

        if (name.equals("int") || name.equals("integer")) {
            return Fields.INT;
        } else if (name.equals("long")) {
            return Fields.LONG;
        } else if (name.equals("float")) {
            return Fields.FLOAT;
        } else if (name.equals("double")) {
            return Fields.DOUBLE;
        } else if (CharSequence.class.isAssignableFrom(clazz)) {
            return Fields.STRING;
        } else if (name.equals("boolean")) {
            return Fields.BOOLEAN;
        } else if (clazz.isAssignableFrom(List.class)) {
            ParameterizedType listType = (ParameterizedType) field.getGenericType();
            Class<?> listClass = (Class<?>) listType.getActualTypeArguments()[0];

            if (listClass.toString().equals("class java.lang.String")) {
                return Fields.LIST;
            }
        }

        throw new RuntimeException("Field not found!");
    }
626647
public static JavaType of(final Class<?> implementClass, final Field field) {
		return of(new ImplementClass(implementClass), field);
	}
643087
public static <T extends FieldDescription> ElementMatcher.Junction<T> genericFieldType(TypeDescription.Generic fieldType) {
        return genericFieldType(is(fieldType));
    }
1029784
public static Field getField(Class<?> type,String fieldName)
    {
        Field field=null;
        try
        {
            //get field
            field=type.getDeclaredField(fieldName);
        }
        catch(Exception exception)
        {
            throw new FaxException("Unable to extract field: "+fieldName+" from type: "+type,exception);
        }

        //set accessible
        field.setAccessible(true);

        return field;
    }
521401
public static SoyValue getProtoField(SoyProtoValue proto, String field) {
    if (proto == null) {
      throw new NullPointerException("Attempted to access field '" + field + "' of null");
    }
    return handleTofuNull(proto.getProtoField(field));
  }
57883
private Indexer getDefaultIndexer(Field field) {
    Type type = field.getGenericType();
    if (type instanceof Class && type.equals(String.class)) {
      return getIndexer(LowerCaseStringIndexer.class);
    } else if (type instanceof ParameterizedType) {
      ParameterizedType parameterizedType = (ParameterizedType) type;
      Class<?> rawType = (Class<?>) parameterizedType.getRawType();
      if (List.class.isAssignableFrom(rawType) || Set.class.isAssignableFrom(rawType)) {
        Class<?>[] collectionType = IntrospectionUtils.resolveCollectionType(type);
        if (String.class.equals(collectionType[1])) {
          return getIndexer(LowerCaseStringListIndexer.class);
        }
      }
    }
    String message = String.format("No default indexer found for field %s in class %s",
        field.getName(), field.getDeclaringClass().getName());
    throw new NoSuitableIndexerException(message);
  }
1034129
public static Optional<Class> resolveGenericTypeArgument(Field field) {
        Type genericType = field != null ? field.getGenericType() : null;
        if (genericType instanceof ParameterizedType) {
            Type[] typeArguments = ((ParameterizedType) genericType).getActualTypeArguments();
            if (typeArguments.length > 0) {
                Type typeArg = typeArguments[0];
                return resolveParameterizedTypeArgument(typeArg);
            }
        }
        return Optional.empty();
    }
871967
public static <A extends Annotation> A getAnnotation(Field field, Class<A> annotationType) {
        if (field == null || annotationType == null) {
            return null;
        }

        return field.getAnnotation(annotationType);
    }
975771
public static <T> List<Field> getDeclaredFields(T type) {
        return new ArrayList<>(asList(type.getClass().getDeclaredFields()));
    }
1167163
protected Type getValueGenericType(AnnotatedElement element) {
        if (element instanceof Field) {
            return ((Field) element).getGenericType();
        }
        if (element instanceof Method) {
            return ((Method) element).getGenericReturnType();
        }
        throw new PropertyLoaderException("Could not get generic type for element");
    }
302621
private Class<?> getFieldRole(Field field, Requirement requirement)
    {
        Class<?> role;

        // Handle case of list or map
        if (isDependencyOfListType(field.getType())) {
            role = getGenericRole(field);
        } else {
            role = field.getType();
        }

        return role;
    }
609384
public Class<?> getGenericType(Field field) {
        Type generic = field.getGenericType();
        if (generic instanceof ParameterizedType) {
            Type actual = ((ParameterizedType) generic).getActualTypeArguments()[0];
            if (actual instanceof Class) {
                return (Class<?>) actual;
            } else if (actual instanceof ParameterizedType) {
                //in case of nested generics we don't go deep
                return (Class<?>) ((ParameterizedType) actual).getRawType();
            }
        }

        return Object.class;
    }
208740
public List<Filter> getAllFiltersForField(String field) {
		List<Filter> foundFilters = new ArrayList<>();

		for (Filter filter : this.filters) {
			if (filter.getField().equals(field)) {
				foundFilters.add(filter);
			}
		}

		return Collections.unmodifiableList(foundFilters);
	}