/** * Searches for {@link HttpMethod} annotations on the provided method and * returns the corresponding GWT RequestBuilder method. * * @param method * @return statement representing the GWT RequestBuilder method */ public static Statement fromMethod(MetaMethod method) { Statement gwtRequestMethod = null; for (Class<? extends Annotation> jaxrsMethod : METHOD_MAP.keySet()) { if (method.isAnnotationPresent(jaxrsMethod)) { gwtRequestMethod = METHOD_MAP.get(jaxrsMethod); break; } } return gwtRequestMethod; } }
@Override public List<MetaMethod> getDeclaredMethodsAnnotatedWith(final Class<? extends Annotation> annotation) { return Arrays.stream(getDeclaredMethods()) .filter(m -> m.isAnnotationPresent(annotation)) .collect(collectingAndThen(Collectors.toList(), l -> Collections.unmodifiableList(l))); }
@Override public List<MetaMethod> getDeclaredMethodsAnnotatedWith(final Class<? extends Annotation> annotation) { return Arrays.stream(getDeclaredMethods()) .filter(m -> m.isAnnotationPresent(annotation)) .collect(collectingAndThen(Collectors.toList(), l -> Collections.unmodifiableList(l))); }
@Override public final List<MetaMethod> getMethodsAnnotatedWith(final Class<? extends Annotation> annotation) { final Map<String, List<MetaMethod>> methodsByName = new HashMap<>(); MetaClass scanTarget = this; while (scanTarget != null) { for (final MetaMethod m : scanTarget.getDeclaredMethods()) { if (m.isAnnotationPresent(annotation)) { final List<MetaMethod> methods = methodsByName.computeIfAbsent(m.getName(), k -> new ArrayList<>()); if (isNotOverriden(m, methods)) { methods.add(m); } } } scanTarget = scanTarget.getSuperClass(); } return Collections .unmodifiableList(methodsByName .values() .stream() .flatMap(list -> list.stream()) .collect(Collectors.toList())); }
@Override public final List<MetaMethod> getMethodsAnnotatedWith(final Class<? extends Annotation> annotation) { final Map<String, List<MetaMethod>> methodsByName = new HashMap<>(); MetaClass scanTarget = this; while (scanTarget != null) { for (final MetaMethod m : scanTarget.getDeclaredMethods()) { if (m.isAnnotationPresent(annotation)) { final List<MetaMethod> methods = methodsByName.computeIfAbsent(m.getName(), k -> new ArrayList<>()); if (isNotOverriden(m, methods)) { methods.add(m); } } } scanTarget = scanTarget.getSuperClass(); } return Collections .unmodifiableList(methodsByName .values() .stream() .flatMap(list -> list.stream()) .collect(Collectors.toList())); }
public static Collection<MetaMethod> getNonBindingAttributes(final MetaClass annoClass) { return filterAnnotationMethods(Arrays.stream(annoClass.getDeclaredMethods()), method -> method.isAnnotationPresent(Nonbinding.class) && method.isPublic() && !method.getName().equals("equals") && !method.getName().equals("hashCode")); }
public static Collection<MetaMethod> getNonBindingAttributes(final MetaClass annoClass) { return filterAnnotationMethods(Arrays.stream(annoClass.getDeclaredMethods()), method -> method.isAnnotationPresent(Nonbinding.class) && method.isPublic() && !method.getName().equals("equals") && !method.getName().equals("hashCode")); }
/** * Returns true if the given Java member is annotated as a JPA generated value. * <p/> * TODO: support this determination for XML-configured entities. * * @param javaMember * the Java member for the attribute in question */ protected boolean isGeneratedValue(Member javaMember) { if (javaMember instanceof Field) { MetaField field = MetaClassFactory.get((Field) javaMember); return field.isAnnotationPresent(GeneratedValue.class); } else if (javaMember instanceof Method) { MetaMethod method = MetaClassFactory.get((Method) javaMember); return method.isAnnotationPresent(GeneratedValue.class); } throw new IllegalArgumentException("Given member is a " + javaMember.getClass().getName() + " but JPA attributes can only be a Field or a Method."); }
public static Collection<MetaMethod> getAnnotationAttributes(final MetaClass annoClass) { return filterAnnotationMethods(Arrays.stream(annoClass.getDeclaredMethods()), method -> !method.isAnnotationPresent(Nonbinding.class) && method.isPublic() && !method.getName().equals("equals") && !method.getName().equals("hashCode")); }
public static Collection<MetaMethod> getAnnotationAttributes(final MetaClass annoClass) { return filterAnnotationMethods(Arrays.stream(annoClass.getDeclaredMethods()), method -> !method.isAnnotationPresent(Nonbinding.class) && method.isPublic() && !method.getName().equals("equals") && !method.getName().equals("hashCode")); }
if (type.isAnnotationPresent(annotation) || method.isAnnotationPresent(annotation)) { interceptors.addAll(featureInterceptors.get(annotation));
if (type.isAnnotationPresent(annotation) || method.isAnnotationPresent(annotation)) { interceptors.addAll(featureInterceptors.get(annotation));
private void resolveProducerSpecialization(final InjectableImpl specialization, final Set<InjectableImpl> toBeRemoved) { final ProducerInstanceDependencyImpl producerMemberDep = GraphUtil.findProducerInstanceDep(specialization); if (producerMemberDep.producingMember instanceof MetaMethod) { final MetaMethod specializedMethod = GraphUtil.getOverridenMethod((MetaMethod) producerMemberDep.producingMember); final MetaClass specializingType = producerMemberDep.producingMember.getDeclaringClass(); if (specializedMethod != null && specializedMethod.isAnnotationPresent(Produces.class)) { updateLinksToSpecialized(specialization, toBeRemoved, specializedMethod, specializingType); } } else { throw new RuntimeException("Specialized producers can only be methods. Found " + producerMemberDep.producingMember + " in " + producerMemberDep.producingMember.getDeclaringClassName()); } }
for (final MetaClass metaClass : getAllReloadableCachedClasses(genCtx)) { for (final MetaMethod metaMethod : metaClass.getDeclaredMethods()) { if (metaMethod.isAnnotationPresent(annotation)) { result.add(metaMethod); for (final MetaClass metaClass : MetaClassFactory.getAllCachedClasses()) { for (final MetaMethod metaMethod : metaClass.getDeclaredMethods()) { if (metaMethod.isAnnotationPresent(annotation)) { result.add(metaMethod);
for (final MetaClass metaClass : getAllReloadableCachedClasses(genCtx)) { for (final MetaMethod metaMethod : metaClass.getDeclaredMethods()) { if (metaMethod.isAnnotationPresent(annotation)) { result.add(metaMethod); for (final MetaClass metaClass : MetaClassFactory.getAllCachedClasses()) { for (final MetaMethod metaMethod : metaClass.getDeclaredMethods()) { if (metaMethod.isAnnotationPresent(annotation)) { result.add(metaMethod);
if (method.isAnnotationPresent(Key.class)) { final String key = method.getAnnotation(Key.class).value();
if (method.isAnnotationPresent(Key.class)) { final String key = method.getAnnotation(Key.class).value();
if (method.isAnnotationPresent(SinkNative.class)) { eventsToSink = method.getAnnotation(SinkNative.class).value();
if (method.isAnnotationPresent(SinkNative.class)) { eventsToSink = method.getAnnotation(SinkNative.class).value();