public ClassResourceInfo(Class<?> theResourceClass, Class<?> theServiceClass, boolean theRoot, boolean enableStatic, Bus bus) { super(theResourceClass, theServiceClass, theRoot, theRoot || enableStatic, bus); this.enableStatic = enableStatic; if (resourceClass != null) { nameBindings = AnnotationUtils.getNameBindings(serviceClass.getAnnotations()); } }
public ClassResourceInfo(Class<?> theResourceClass, Class<?> theServiceClass, boolean theRoot, boolean enableStatic, Bus bus) { super(theResourceClass, theServiceClass, theRoot, theRoot || enableStatic, bus); this.enableStatic = enableStatic; if (resourceClass != null) { nameBindings = AnnotationUtils.getNameBindings(serviceClass.getAnnotations()); } }
protected static Set<String> getFilterNameBindings(Bus bus, Object provider) { Class<?> pClass = ClassHelper.getRealClass(bus, provider); Set<String> names = AnnotationUtils.getNameBindings(pClass.getAnnotations()); if (names.isEmpty()) { names = Collections.singleton(DEFAULT_FILTER_NAME_BINDING); } return names; }
@Override public int compare(ProviderInfo<?> p1, ProviderInfo<?> p2) { int result = super.compare(p1, p2); if (result == 0) { Integer namesSize1 = AnnotationUtils.getNameBindings(p1.getProvider().getClass().getAnnotations()).size(); Integer namesSize2 = AnnotationUtils.getNameBindings(p2.getProvider().getClass().getAnnotations()).size(); // if we have two filters with the same binding priority, // then put a filter with more name bindings upfront // (this effectively puts name bound filters before global ones) result = namesSize1.compareTo(namesSize2) * -1; } return result; } }
public void setApplicationInfo(ApplicationInfo provider) { appProvider = provider; Set<String> appNameBindings = AnnotationUtils.getNameBindings(provider.getProvider() .getClass().getAnnotations()); for (ClassResourceInfo cri : getServiceFactory().getClassResourceInfo()) { Set<String> clsNameBindings = new LinkedHashSet<>(appNameBindings); clsNameBindings.addAll(AnnotationUtils.getNameBindings(cri.getServiceClass().getAnnotations())); cri.setNameBindings(clsNameBindings); } }
private static <T> void mapContainerFilters(Map<NameKey, ProviderInfo<T>> map, List<ProviderInfo<T>> postMatchFilters, boolean ascending) { Collections.sort(postMatchFilters, new PostMatchFilterComparator(ascending)); for (ProviderInfo<T> p : postMatchFilters) { List<String> names = AnnotationUtils.getNameBindings( p.getProvider().getClass().getAnnotations()); names = names.isEmpty() ? Collections.singletonList(DEFAULT_FILTER_NAME_BINDING) : names; for (String name : names) { map.put(new NameKey(name, AnnotationUtils.getBindingPriority(p.getProvider().getClass())), p); } } }
/** * Saves the reference to the JAX-RS {@link Application} * @param app */ public void setApplication(Application app) { appProvider = new ProviderInfo<Application>(app, getBus()); List<String> appNameBindings = AnnotationUtils.getNameBindings(app.getClass().getAnnotations()); for (ClassResourceInfo cri : getServiceFactory().getClassResourceInfo()) { List<String> clsNameBindings = new LinkedList<String>(appNameBindings); clsNameBindings.addAll(AnnotationUtils.getNameBindings(cri.getServiceClass().getAnnotations())); cri.setNameBindings(clsNameBindings); } }
public OperationResourceInfo(Method mInvoke, Method mAnnotated, ClassResourceInfo cri) { methodToInvoke = mInvoke; annotatedMethod = mAnnotated; if (mAnnotated != null) { parameters = ResourceUtils.getParameters(mAnnotated); nameBindings = AnnotationUtils.getNameBindings(mAnnotated.getAnnotations()); } classResourceInfo = cri; checkMediaTypes(null, null); checkEncoded(); checkDefaultParameterValue(); checkOneway(); }
public OperationResourceInfo(Method mInvoke, Method mAnnotated, ClassResourceInfo cri) { methodToInvoke = mInvoke; annotatedMethod = mAnnotated; if (mAnnotated != null) { parameters = ResourceUtils.getParameters(mAnnotated); nameBindings = AnnotationUtils.getNameBindings(mAnnotated.getAnnotations()); } classResourceInfo = cri; checkMediaTypes(null, null); checkEncoded(); checkDefaultParameterValue(); checkOneway(); checkSuspended(); initActualMethodProperties(); }