give a class or Field or Method, return annotations
541224
private static Annotation[] getAnnotations(Object targetClass) {
		if (targetClass instanceof Field)
			return ((Field) targetClass).getAnnotations();
		else if (targetClass instanceof Method)
			return ((Method) targetClass).getAnnotations();
		else if (targetClass instanceof Constructor)
			return ((Constructor<?>) targetClass).getAnnotations();
		else if (targetClass instanceof Class)
			return ((Class<?>) targetClass).getAnnotations();
		else
			return BeanBoxException.throwEX("targetClass should be Field, Method, Constructor or Class");
	}
1169361
public Set<Method> getMethodsWithAnyParamAnnotated(Class<? extends Annotation> annotation) {
        return getMethodsFromDescriptors(store.get(index(MethodParameterScanner.class), annotation.getName()), loaders());

    }
796955
def get_annotations(event, key, namespace=None, matchfunc=None):
    """"""
    if matchfunc is None:
        matchfunc = _is_equal
    if isinstance(key, Exception):
        key = _error_repr(key)
    return [ann for ann in event.get("_humilis", {}).get("annotation", [])
            if (matchfunc(key, ann["key"]) and
                (namespace is None or ann.get("namespace") == namespace))]
591981
public static <A extends Annotation> A getAnnotation(final Class<A> annotation, final Method method) {
        try {
            return DaemonScanner.isAnnotationPresent(annotation, method.getDeclaringClass(), method.getName(), method.getParameterTypes());
        } catch(final NoSuchMethodException e) {
            return null;
        }
    }
1332054
def get_annotated_fields(cls, instance, select=lambda *p: True):
        

        result = {}

        for _, member in getmembers(instance):
            try:
                annotations = cls.get_annotations(
                    target=member, ctx=instance, select=select
                )

            except TypeError:
                pass

            else:
                try:
                    if annotations:
                        result[member] = annotations

                except TypeError:  # if field is an object proxy
                    pass

        return result
435869
public static <A extends Annotation> A getAnnotation(final Method method, final Class<A> annotationType) {
        A ann = method.getAnnotation(annotationType);
        if (ann == null) {
            for (final Annotation metaAnn : method.getAnnotations()) {
                ann = metaAnn.annotationType().getAnnotation(annotationType);
                if (ann != null) {
                    break;
                }
            }
        }
        return ann;
    }
1202611
private Set<Annotation> getFieldAnnotations(final Class<?> clazz)
	{
		try
		{
			return new LinkedHashSet<Annotation>(asList(clazz.getDeclaredField(propertyName).getAnnotations()));
		}
		catch (final NoSuchFieldException e)
		{
			if (clazz.getSuperclass() != null)
			{
				return getFieldAnnotations(clazz.getSuperclass());
			}
			else
			{
				logger.debug("Cannot find propertyName: {}, declaring class: {}", propertyName, clazz);
				return new LinkedHashSet<Annotation>(0);
			}
		}
	}
317475
public static Field[] getAnnotationFields(Class<?> clazz, Class<? extends Annotation> annotationClass) {
        if (clazz == null || annotationClass == null) {
            return null;
        }

        List<Field> fields = getAllFieldsOfClass0(clazz);
        if (CollectionUtil.isEmpty(fields)) {
            return null;
        }

        List<Field> list = CollectionUtil.createArrayList();
        for (Field field : fields) {
            if (null != field.getAnnotation(annotationClass)) {
                list.add(field);
                field.setAccessible(true);
            }
        }

        return list.toArray(new Field[0]);
    }
1133243
def get_annotation(self, key, result_format='list'):
        
        value = self.get('_annotations_by_key', {}).get(key)
        if not value:
            return value

        if result_format == 'one':
            return value[0]

        return value
1024319
def get_class(context, field, obj=None):
    
    view = context['view']
    return view.lookup_field_class(field, obj, "field_" + field)
778854
private MethodSpec buildClassGetterMethod() {
        return MethodSpec.methodBuilder( isSerializer() ? "getSerializedType" : "getDeserializedType" )
                .addModifiers( Modifier.PUBLIC )
                .addAnnotation( Override.class )
                .returns( Class.class )
                .addStatement( "return $T.class", rawName( beanInfo.getType() ) )
                .build();
    }
636902
@SuppressWarnings("unchecked")
	public List<MethodParameter> getParametersWith(Class<? extends Annotation> annotation) {

		Assert.notNull(annotation, "Annotation must not be null!");

		return parametersWithAnnotationCache.computeIfAbsent(annotation, key -> {

			return getParameters().stream()//
					.filter(it -> it.hasParameterAnnotation((Class<? extends Annotation>) key))//
					.collect(Collectors.toList());
		});
	}
36632
private static List<Field> _getAnnotationColumns(Class<?> clazz, 
			Class<? extends Annotation> annoClazz) {
		if(clazz == null) {
			return new ArrayList<Field>();
		}
		
		List<Class<?>> classLink = new ArrayList<Class<?>>();
		Class<?> curClass = clazz;
		while (curClass != null) {
			classLink.add(curClass);
			curClass = curClass.getSuperclass();
		}
		
		return _getFields(classLink, annoClazz);
	}
836133
@SuppressWarnings("rawtypes")
    public Method getAnnotatedMethod(Class clazz, Class<? extends Annotation> annotationClass) {
        Method m = null;

        Method[] methods = clazz.getDeclaredMethods();

        for (int i = 0; i < methods.length; i++) {
            Annotation[] a = methods[i].getAnnotations();
            if (a != null) {
                for (int j = 0; j < a.length; j++) {
                    if (a[j].annotationType() == annotationClass) {
                        if (m == null) {
                            m = methods[i];
                        } else {
                            Tr.warning(tc, "DUPLICATE_CALLBACK_METHOD_CWWKC2454W", new Object[] { methods[i].getName(), clazz.getName() });
                        }
                    }
                }
            }
        }
        return m;
    }
566220
def GetAnnotatedMethods(cls):
    """"""

    result = {}

    # We want methods with the highest call-order to be processed last,
    # so that their annotations have precedence.
    for i_cls in reversed(inspect.getmro(cls)):
      for name in compatibility.ListAttrs(i_cls):
        cls_method = getattr(i_cls, name)

        if not callable(cls_method):
          continue

        if not hasattr(cls_method, "__http_methods__"):
          continue

        result[name] = RouterMethodMetadata(
            name=name,
            doc=cls_method.__doc__,
            args_type=getattr(cls_method, "__args_type__", None),
            result_type=getattr(cls_method, "__result_type__", None),
            category=getattr(cls_method, "__category__", None),
            http_methods=getattr(cls_method, "__http_methods__", set()),
            no_audit_log_required=getattr(cls_method,
                                          "__no_audit_log_required__", False))

    return result
485877
public static <T extends Annotation> T getAnnotation(Method method, Class<T> annotationClass) {
        T annotation = method.getAnnotation(annotationClass);
        if (annotation == null) {
            annotation = getAnnotation(method.getDeclaringClass(), annotationClass);
        }

        return annotation;
    }
283223
public static List<Method> getAnnotatedMethods(final Class<?> cls, final Class<? extends Annotation> annotationClass) {
        final List<Method> methodList = new ArrayList<>();

        // Retrieve annotation even when they are wrapped into OnWaves
        for (final Method m : cls.getDeclaredMethods()) {
            if (m.getAnnotationsByType(annotationClass).length > 0) {
                methodList.add(m);
            }
        }

        // Add implemented interfaces methods
        for (final Class<?> i : cls.getInterfaces()) {
            methodList.addAll(getAnnotatedMethods(i, annotationClass));
        }

        // Add super class methods
        if (cls.getSuperclass() != null) {
            methodList.addAll(getAnnotatedMethods(cls.getSuperclass(), annotationClass));
        }

        return methodList;
    }