Matches if an annotation is of a given type.

@param type The expected annotation type.
@param <T>  The type of the matched object.
@return A matcher that matches the annotation's type for being equal to the given type.
10094
public static <T extends AnnotationDescription> ElementMatcher.Junction<T> annotationType(TypeDescription type) {
        return annotationType(is(type));
    }
708912
@Factory
    public static <T extends Throwable> Matcher<T> isThrowable(Class<?> type) {
        final Matcher<T> typeMatcher = instanceOf(type);
        return new IsThrowable<>(typeMatcher);
    }
59741
@Override
  public boolean accept(Class<?> type) {

    if (type != null) {
      if (this.forceInheritence) {
        Annotation annotation = this.annotationUtil.getTypeAnnotation(type, this.annotationType);
        return (annotation != null);
      } else {
        return type.isAnnotationPresent(this.annotationType);
      }

    }
    return false;
  }
459654
public static boolean isRawType(final Type type) {
        if (type instanceof Class) {
            final Class<?> clazz = (Class<?>) type;
            return (clazz.getTypeParameters().length > 0);
        }
        if (type instanceof ParameterizedType) {
            final ParameterizedType ptype = (ParameterizedType) type;
            return (ptype.getActualTypeArguments().length == 0);
        }
        return false;
    }
1185711
public static <T extends FieldDescription> ElementMatcher.Junction<T> genericFieldType(ElementMatcher<? super TypeDescription.Generic> matcher) {
        return new FieldTypeMatcher<T>(matcher);
    }
427566
public static List<Method> findMethods(Class<?> type,
			Class<? extends Annotation> annotation) {
		List<Method> list = new ArrayList<Method>();
		while (type != null) {
			for (Method method : type.getDeclaredMethods()) {
				if (method.getAnnotation(annotation) != null) {
					list.add(method);
				}
			}
			type = type.getSuperclass();
		}
		return list;
	}
520409
public <T> DomainObjectMatch<T> AS(Class<T> domainObjectType) {
		CollectExpression ce = (CollectExpression)this.astObject;
		DomainObjectMatch<T> ret =APIAccess.createDomainObjectMatch(domainObjectType,
				ce.getQueryExecutor().getDomainObjectMatches().size(),
				ce.getQueryExecutor().getMappingInfo());
		ce.setEnd(ret);
		ce.getQueryExecutor().getDomainObjectMatches().add(ret);
		QueryRecorder.recordAssignment(this, "AS", ret, QueryRecorder.literal(domainObjectType.getName()));
		return ret;
	}
560410
final public Boolean checkPositionType(String type) {
    if (tokenPosition == null) {
      return false;
    } else {
      return tokenPosition.checkType(type);
    }
  }
424226
public static <T extends Annotation> T getAnnotation(Method method, Class<T> type) {
		for (Annotation a : getAnnotations(method)) {
			if (type.isInstance(a)) {
				return type.cast(a);
			}
		}
		return null;
	}
359756
public static <T extends FieldDescription> ElementMatcher.Junction<T> fieldType(TypeDescription fieldType) {
        return fieldType(is(fieldType));
    }
1200354
public AnnotatedTypeBuilder<X> readFromType(Class<X> type, boolean overwrite) {
      if (type == null) {
         throw log.parameterMustNotBeNull("type");
      }
      if (javaClass == null || overwrite) {
         this.javaClass = type;
      }
      for (Annotation annotation : type.getAnnotations()) {
         if (overwrite || !typeAnnotations.isAnnotationPresent(annotation.annotationType())) {
            typeAnnotations.add(annotation);
         }
      }

      for (Field field : Reflections.getAllDeclaredFields(type)) {
         AnnotationBuilder annotationBuilder = fields.get(field);
         if (annotationBuilder == null) {
            annotationBuilder = new AnnotationBuilder();
            fields.put(field, annotationBuilder);
         }
         field.setAccessible(true);
         for (Annotation annotation : field.getAnnotations()) {
            if (overwrite || !annotationBuilder.isAnnotationPresent(annotation.annotationType())) {
               annotationBuilder.add(annotation);
            }
         }
      }

      for (Method method : Reflections.getAllDeclaredMethods(type)) {
         AnnotationBuilder annotationBuilder = methods.get(method);
         if (annotationBuilder == null) {
            annotationBuilder = new AnnotationBuilder();
            methods.put(method, annotationBuilder);
         }
         method.setAccessible(true);
         for (Annotation annotation : method.getAnnotations()) {
            if (overwrite || !annotationBuilder.isAnnotationPresent(annotation.annotationType())) {
               annotationBuilder.add(annotation);
            }
         }

         Map<Integer, AnnotationBuilder> parameters = methodParameters.get(method);
         if (parameters == null) {
            parameters = new HashMap<Integer, AnnotationBuilder>();
            methodParameters.put(method, parameters);
         }
         for (int i = 0; i < method.getParameterTypes().length; ++i) {
            AnnotationBuilder parameterAnnotationBuilder = parameters.get(i);
            if (parameterAnnotationBuilder == null) {
               parameterAnnotationBuilder = new AnnotationBuilder();
               parameters.put(i, parameterAnnotationBuilder);
            }
            for (Annotation annotation : method.getParameterAnnotations()[i]) {
               if (overwrite || !parameterAnnotationBuilder.isAnnotationPresent(annotation.annotationType())) {
                  parameterAnnotationBuilder.add(annotation);
               }
            }
         }
      }

      for (Constructor<?> constructor : type.getDeclaredConstructors()) {
         AnnotationBuilder annotationBuilder = constructors.get(constructor);
         if (annotationBuilder == null) {
            annotationBuilder = new AnnotationBuilder();
            constructors.put(constructor, annotationBuilder);
         }
         constructor.setAccessible(true);
         for (Annotation annotation : constructor.getAnnotations()) {
            if (overwrite || !annotationBuilder.isAnnotationPresent(annotation.annotationType())) {
               annotationBuilder.add(annotation);
            }
         }
         Map<Integer, AnnotationBuilder> mparams = constructorParameters.get(constructor);
         if (mparams == null) {
            mparams = new HashMap<Integer, AnnotationBuilder>();
            constructorParameters.put(constructor, mparams);
         }
         for (int i = 0; i < constructor.getParameterTypes().length; ++i) {
            AnnotationBuilder parameterAnnotationBuilder = mparams.get(i);
            if (parameterAnnotationBuilder == null) {
               parameterAnnotationBuilder = new AnnotationBuilder();
               mparams.put(i, parameterAnnotationBuilder);
            }
            for (Annotation annotation : constructor.getParameterAnnotations()[i]) {
               if (overwrite || !parameterAnnotationBuilder.isAnnotationPresent(annotation.annotationType())) {
                  annotationBuilder.add(annotation);
               }
            }
         }
      }
      return this;
   }
1067083
@SuppressWarnings("unchecked")
    public <T extends XPathBuilder> T setType(final String type) {
        this.type = type;
        return (T) this;
    }
252524
public static <T extends Tree> Matcher<T> isSubtypeOf(Supplier<Type> type) {
    return new IsSubtypeOf<>(type);
  }
536347
public static Predicate<Field> ofType(Class<?> type) {
        return field -> field.getType().equals(type);
    }
472607
public static <T extends MethodDescription> ElementMatcher.Junction<T> isGetter(TypeDescription type) {
        return isGetter(is(type));
    }
842885
public static <T extends Tree> Matcher<T> isArrayType() {
    return new Matcher<T>() {
      @Override
      public boolean matches(Tree t, VisitorState state) {
        Type type = getType(t);
        return type != null && state.getTypes().isArray(type);
      }
    };
  }
201163
public static <T> Key<T> of(Class<T> type,
                              Class<? extends Annotation> annType)
  {
    Objects.requireNonNull(type);
    Objects.requireNonNull(annType);

    return new Key<>(type, new Class[] { annType });
  }