Resolves the generic parameter name of a class.

@param parameterName the parameter name
@param target        the target class

@return the parameter class.
348376
static Class<?> resolveParameterName(String parameterName, Class<?> target) {
    Map<Type, Type> typeVariableMap = getTypeVariableMap(target);
    Set<Entry<Type, Type>> set = typeVariableMap.entrySet();
    Type type = Object.class;

    for (Entry<Type, Type> entry : set) {
      if (entry.getKey().toString().equals(parameterName)) {
        type = entry.getKey();
        break;
      }
    }
    return resolveType(type, typeVariableMap);
  }
1316859
public static ParameterizedTypeName get(Class<?> rawType, Type... typeArguments) {
    return new ParameterizedTypeName(null, ClassName.get(rawType), list(typeArguments));
  }
272999
public ImmutableList<ASTParameter> getParameters(Class<?>[] parameterTypes, Type[] genericParameterTypes, Annotation[][] parameterAnnotations) {

        ImmutableList.Builder<ASTParameter> astParameterBuilder = ImmutableList.builder();

        for (int i = 0; i < parameterTypes.length; i++) {
            ASTType parameterType = getType(parameterTypes[i], nullSafeAccess(genericParameterTypes, i));
            String name = null;
            for (Annotation parameterAnnotation : parameterAnnotations[i]) {
                if(parameterAnnotation.annotationType().equals(ASTParameterName.class)){
                    name = ((ASTParameterName)parameterAnnotation).value();
                }
            }
            astParameterBuilder.add(
                    new ASTClassParameter(
                            name,
                            parameterAnnotations[i],
                            parameterType,
                            getAnnotations(parameterAnnotations[i])));
        }

        return astParameterBuilder.build();
    }
836838
public static <T> T getFieldValue(Object target, String fieldName) {
        try {
            Field field = target.getClass().getDeclaredField(fieldName);
            field.setAccessible(true);
            @SuppressWarnings("unchecked")
            T returnValue = (T) field.get(target);
            return returnValue;
        } catch (NoSuchFieldException e) {
            throw handleException(fieldName, e);
        } catch (IllegalAccessException e) {
            throw handleException(fieldName, e);
        }
    }
607184
public void registerJavaPropertyNameProcessor( Class target, PropertyNameProcessor propertyNameProcessor ) {
      if( target != null && propertyNameProcessor != null ) {
         javaPropertyNameProcessorMap.put( target, propertyNameProcessor );
      }
   }
967103
private void validateParameterResolvers(MethodTarget methodTarget) {
		Utils.createMethodParameters(methodTarget.getMethod())
				.forEach(parameter -> {
					parameterResolvers.stream()
							.filter(resolver -> resolver.supports(parameter))
							.findFirst()
							.orElseThrow(() -> new ParameterResolverMissingException(parameter));
				});
	}
232561
@Deprecated
    public <T> Class<T> getPropertyAsClass(String key, Class<T> targetType) {
        Optional<String> property = propertyResolver.getProperty(NameUtils.hyphenate(key), String.class);
        if (property.isPresent()) {
            Optional<Class> aClass = ClassUtils.forName(property.get(), Thread.currentThread().getContextClassLoader());
            if (aClass.isPresent()) {
                //noinspection unchecked
                return aClass.get();
            }
        }
        return null;
    }
529156
public static Class getParameterizedClass(final Class c, final int index) {
        final TypeVariable[] typeVars = c.getTypeParameters();
        if (typeVars.length > 0) {
            final TypeVariable typeVariable = typeVars[index];
            final Type[] bounds = typeVariable.getBounds();

            final Type type = bounds[0];
            if (type instanceof Class) {
                return (Class) type; // broke for EnumSet, cause bounds contain
                // type instead of class
            } else {
                return null;
            }
        } else {
            Type superclass = c.getGenericSuperclass();
            if (superclass == null && c.isInterface()) {
                Type[] interfaces = c.getGenericInterfaces();
                if (interfaces.length > 0) {
                    superclass = interfaces[index];
                }
            }
            if (superclass instanceof ParameterizedType) {
                final Type[] actualTypeArguments = ((ParameterizedType) superclass).getActualTypeArguments();
                return actualTypeArguments.length > index ? (Class<?>) actualTypeArguments[index] : null;
            } else if (!Object.class.equals(superclass)) {
                return getParameterizedClass((Class) superclass);
            } else {
                return null;
            }
        }
    }
889663
public static MethodIdentifier getIdentifier(final Class<?> returnType, final String name, final Class<?>... parameterTypes) {
        return new MethodIdentifier(returnType.getName(), name, namesOf(parameterTypes));
    }
961347
public TypeName findParameterTypeByAliasOrName(String name) {
		if (parameterAlias2NameField.containsKey(name)) {
			return findParameterType(parameterAlias2NameField.get(name));
		}

		return findParameterType(name);
	}
798929
public static <T extends Annotation> T getAnnotation( Class<?> target, Class<T> annotationClass) {
        Class<?> clazz = target;
        T annotation = clazz.getAnnotation(annotationClass);
        if(annotation != null) {
            return annotation;
        }
        while((clazz = clazz.getSuperclass()) != null) {
            annotation = clazz.getAnnotation(annotationClass);
            if(annotation != null) {
                return annotation;
            }
        }
        return null;
    }
573410
public static <T> Class<T> getTypeParameter(Class<?> klass, Class<? super T> bound) {
        Type t = requireNonNull(klass);
        while (t instanceof Class<?>) {
            t = ((Class<?>) t).getGenericSuperclass();
        }
        /* This is not guaranteed to work for all cases with convoluted piping
         * of type parameters: but it can at least resolve straight-forward
         * extension with single type parameter (as per [Issue-89]).
         * And when it fails to do that, will indicate with specific exception.
         */
        if (t instanceof ParameterizedType) {
            // should typically have one of type parameters (first one) that matches:
            for (Type param : ((ParameterizedType) t).getActualTypeArguments()) {
                if (param instanceof Class<?>) {
                    final Class<T> cls = determineClass(bound, param);
                    if (cls != null) {
                        return cls;
                    }
                } else if (param instanceof TypeVariable) {
                    for (Type paramBound : ((TypeVariable<?>) param).getBounds()) {
                        if (paramBound instanceof Class<?>) {
                            final Class<T> cls = determineClass(bound, paramBound);
                            if (cls != null) {
                                return cls;
                            }
                        }
                    }
                } else if (param instanceof ParameterizedType) {
                    final Type rawType = ((ParameterizedType) param).getRawType();
                    if (rawType instanceof Class<?>) {
                        final Class<T> cls = determineClass(bound, rawType);
                        if (cls != null) {
                            return cls;
                        }
                    }
                }
            }
        }
        throw new IllegalStateException("Cannot figure out type parameterization for " + klass.getName());
    }
1115446
public static String getParameterName(Parameter parameter) {
        // identify parameter name and pattern from method signature
        String methodParameterName = parameter.getName();
        if (parameter.isAnnotationPresent(Param.class)) {
            Param param = parameter.getAnnotation(Param.class);
            if (!Strings.isNullOrEmpty(param.value())) {
                methodParameterName = param.value();
            }
        }
        return methodParameterName;
    }
1315365
public String getParameter( String name )
    {
        if (_parameters == null || !_parameters.hasParameters())
            return null;

        List parameters = _parameters.getParameterValues(name);
        if(parameters != null && parameters.size() > 0)
            return (String)parameters.get(0);
        else return null;
    }
943149
public static String getParameter(final String parameterName)
	{
		final Request request = RequestCycle.get().getRequest();
		return getParameter(request, parameterName);
	}
412091
public Class<? extends T> resolveClass(final String aliasOrClassName) throws ClassNotFoundException {
    if (this.aliasToClassCache.containsKey(aliasOrClassName.toUpperCase())) {
      return this.aliasToClassCache.get(aliasOrClassName.toUpperCase());
    }
    try {
      return Class.forName(aliasOrClassName).asSubclass(this.subtypeOf);
    } catch (ClassCastException cce) {
      throw new ClassNotFoundException(
          String.format("Found class %s but it cannot be cast to %s.", aliasOrClassName, this.subtypeOf.getName()), cce);
    }
  }
1185477
public static ObjectMethodMatchConf findMethod(Class target, String methodName, Class[] parameterType)
	{

		List<Method> ms = getObjectInfo(target).getMethods(methodName);

		if (ms == null || ms.size() == 0)
		{
			return null;
		}

		Method temp = null;
		for (int i = 0; i < ms.size(); i++)
		{
			temp = ms.get(i);

			ObjectMethodMatchConf selfMc = match(temp, parameterType);
			if (selfMc != null)
			{

				return selfMc;

			}

		}

		return null;
	}