@Override public UriBuilder path(Method method) throws IllegalArgumentException { if (method == null) { throw new IllegalArgumentException("method is null"); } Path ann = method.getAnnotation(Path.class); if (ann == null) { throw new IllegalArgumentException("Method '" + method.getClass().getCanonicalName() + "." + method.getName() + "' is not annotated with Path"); } // path(String) decomposes multi-segment path when necessary return path(ann.value()); }
@Override public UriBuilder path(@SuppressWarnings("rawtypes") Class resource) throws IllegalArgumentException { if (resource == null) { throw new IllegalArgumentException("resource is null"); } Class<?> cls = resource; Path ann = cls.getAnnotation(Path.class); if (ann == null) { throw new IllegalArgumentException("Class '" + resource.getCanonicalName() + "' is not annotated with Path"); } // path(String) decomposes multi-segment path when necessary return path(ann.value()); }
@Override public UriBuilder path(Method method) throws IllegalArgumentException { if (method == null) { throw new IllegalArgumentException("method is null"); } Path ann = method.getAnnotation(Path.class); if (ann == null) { throw new IllegalArgumentException("Method '" + method.getClass().getCanonicalName() + "." + method.getName() + "' is not annotated with Path"); } // path(String) decomposes multi-segment path when necessary return path(ann.value()); }
@Override public UriBuilder path(Class<?> resource) throws IllegalArgumentException { if (resource == null) { throw new IllegalArgumentException("resource is null"); } Class<?> cls = resource; Path ann = cls.getAnnotation(Path.class); if (ann == null) { throw new IllegalArgumentException("Class '" + resource.getCanonicalName() + "' is not annotated with Path"); } // path(String) decomposes multi-segment path when necessary return path(ann.value()); }
@Override public UriBuilder path(@SuppressWarnings("rawtypes") Class resource, String method) throws IllegalArgumentException { if (resource == null) { throw new IllegalArgumentException("resource is null"); } if (method == null) { throw new IllegalArgumentException("method is null"); } Path foundAnn = null; for (Method meth : resource.getMethods()) { if (meth.getName().equals(method)) { Path ann = meth.getAnnotation(Path.class); if (foundAnn != null && ann != null) { throw new IllegalArgumentException("Multiple Path annotations for '" + method + "' overloaded method"); } foundAnn = ann; } } if (foundAnn == null) { throw new IllegalArgumentException("No Path annotation for '" + method + "' method"); } // path(String) decomposes multi-segment path when necessary return path(foundAnn.value()); }
@Override public UriBuilder path(Class<?> resource, String method) throws IllegalArgumentException { if (resource == null) { throw new IllegalArgumentException("resource is null"); } if (method == null) { throw new IllegalArgumentException("method is null"); } Path foundAnn = null; for (Method meth : resource.getMethods()) { if (meth.getName().equals(method)) { Path ann = meth.getAnnotation(Path.class); if (foundAnn != null && ann != null) { throw new IllegalArgumentException("Multiple Path annotations for '" + method + "' overloaded method"); } foundAnn = ann; } } if (foundAnn == null) { throw new IllegalArgumentException("No Path annotation for '" + method + "' method"); } // path(String) decomposes multi-segment path when necessary return path(foundAnn.value()); }