Matches a field's raw type against the provided matcher.

@param fieldType The field type to match.
@param <T>       The type of the matched object.
@return A matcher matching the provided field type.
359756
public static <T extends FieldDescription> ElementMatcher.Junction<T> fieldType(TypeDescription fieldType) {
        return fieldType(is(fieldType));
    }
964057
public ClassBuilder<T> withField(String field, Class<?> fieldClass) {
		fields.put(field, fieldClass);
		return this;
	}
198274
public static Matcher<TypeCastTree> typeCast(
      final Matcher<Tree> typeMatcher, final Matcher<ExpressionTree> expressionMatcher) {
    return new Matcher<TypeCastTree>() {
      @Override
      public boolean matches(TypeCastTree t, VisitorState state) {
        return typeMatcher.matches(t.getType(), state)
            && expressionMatcher.matches(t.getExpression(), state);
      }
    };
  }
871967
public static <A extends Annotation> A getAnnotation(Field field, Class<A> annotationType) {
        if (field == null || annotationType == null) {
            return null;
        }

        return field.getAnnotation(annotationType);
    }
643087
public static <T extends FieldDescription> ElementMatcher.Junction<T> genericFieldType(TypeDescription.Generic fieldType) {
        return genericFieldType(is(fieldType));
    }
1255884
public static <T> DecomposableMatchBuilder0<Optional<T>> some(MatchesExact<T> t) {
    List<Matcher<Object>> matchers = Lists.of(ArgumentMatchers.eq(t.t));
    return new DecomposableMatchBuilder0<Optional<T>>(matchers, new OptionalFieldExtractor<>());
  }
698913
public static <T extends FieldDescription> ElementMatcher.Junction<T> genericFieldType(Type fieldType) {
        return genericFieldType(TypeDefinition.Sort.describe(fieldType));
    }
45469
@SuppressWarnings("unchecked")
    public static <T> T castObject(final Object castObject,
                                   final Class<T> fieldType) {
        if(fieldType == null)
            return null;

        final boolean isTypeString = fieldType.equals(String.class);
        if(castObject == null) {
            return (isTypeString)
                    ? ((T) "null")
                    : null;
        }

        final Class<?> castType         = castObject.getClass();
        final boolean isTypeAssignable  = fieldType.isAssignableFrom(castType);
        final boolean isTypeEquals      = areEquals(castType, fieldType);
        final boolean isTypeObject      = fieldType.equals(Object.class);

        return castObject(castObject, fieldType,
                isTypeAssignable, isTypeEquals,
                isTypeObject, isTypeString);
    }
93769
public static JavaType of(final ImplementClass implementClass, final Field field) {
		return of(implementClass, field.getGenericType());
	}
162694
private static void fieldTypeSignature(Result sb, TypeMirror type) throws IOException
    {
        switch (type.getKind())
        {
            case DECLARED:
                classTypeSignature(sb, type);
                break;
            case TYPEVAR:
                typeVariableSignature(sb, (TypeVariable)type);
                break;
            case ARRAY:
                arrayTypeSignature(sb, (ArrayType)type);
                break;
            default:
                //throw new UnsupportedOperationException(type.getKind()+" unsupported");
        }
    }
581419
public static Matcher<ExpressionTree> isInstanceField() {
    return new Matcher<ExpressionTree>() {
      @Override
      public boolean matches(ExpressionTree expressionTree, VisitorState state) {
        Symbol symbol = ASTHelpers.getSymbol(expressionTree);
        return symbol != null && symbol.getKind() == ElementKind.FIELD && !symbol.isStatic();
      }
    };
  }
1119539
public static <T extends Tree> Matcher<T> isSameType(Supplier<Type> type) {
    return new IsSameType<>(type);
  }
10505
public static <T extends MethodDescription> ElementMatcher.Junction<T> isSetter(TypeDescription type) {
        return isSetter(is(type));
    }
329472
public static Type getType(Field field) {
		if (null == field) {
			return null;
		}
		Type type = field.getGenericType();
		if (null == type) {
			type = field.getType();
		}
		return type;
	}
1302739
public static Set<Type> getTypedTypes(Map<Class<?>, Type> typeClosure, Class<?> rawType, Typed typed) {
        Set<Type> types = new HashSet<Type>();
        for (Class<?> specifiedClass : typed.value()) {
            Type tmp = typeClosure.get(specifiedClass);
            if (tmp != null) {
                types.add(tmp);
            } else {
                throw BeanLogger.LOG.typedClassNotInHierarchy(specifiedClass.getName(), rawType, Formats.formatTypes(typeClosure.values()));
            }
        }
        types.add(Object.class);
        return types;
    }
1159171
public Token getMatchedToken(final int tokenType) throws RecognitionException {
        Token result = parser.getCurrentToken();
        boolean isIdentifierCompatible = false;
        if (identifierTokenIndex == tokenType && identifierTokenIndex > result.getType()) {
            isIdentifierCompatible = true;
        }
        if (result.getType() == tokenType || isIdentifierCompatible) {
            if (Token.EOF != tokenType && isIdentifierCompatible && result instanceof CommonToken) {
                ((CommonToken) result).setType(identifierTokenIndex);
            }
            parser.getErrorHandler().reportMatch(parser);
            parser.consume();
        } else {
            result = parser.getErrorHandler().recoverInline(parser);
            if (parser.getBuildParseTree() && -1 == result.getTokenIndex()) {
                parser.getContext().addErrorNode(parser.createErrorNode(parser.getContext(), result));
            }
        }
        return result;
    }
207961
public <T> DomainObjectMatch<T> createMatch(Class<T> domainObjectType) {
		DomainObjectMatch<T> ret = createMatchInternal(domainObjectType);
		QueryRecorder.recordAssignment(this, "createMatch", ret,
				QueryRecorder.literal(domainObjectType.getName()));
		return ret;
	}