@Override public UriBuilder segment(String... segments) throws IllegalArgumentException { if (segments == null) throw new IllegalArgumentException(Messages.MESSAGES.segmentsParameterNull()); for (String segment : segments) { if (segment == null) throw new IllegalArgumentException(Messages.MESSAGES.segmentNull()); path(Encode.encodePathSegment(segment)); } return this; }
@Override public UriBuilder path(Class resource, String method) throws IllegalArgumentException { if (resource == null) throw new IllegalArgumentException(Messages.MESSAGES.resourceNull()); if (method == null) throw new IllegalArgumentException(Messages.MESSAGES.methodNull()); Method theMethod = null; for (Method m : resource.getMethods()) { if (m.getName().equals(method)) { if (theMethod != null && m.isAnnotationPresent(Path.class)) { throw new IllegalArgumentException(Messages.MESSAGES.twoMethodsSameName(method)); } if (m.isAnnotationPresent(Path.class)) theMethod = m; } } if (theMethod == null) throw new IllegalArgumentException(Messages.MESSAGES.noPublicPathAnnotatedMethod(resource.getName(), method)); return path(theMethod); }
@Override public UriBuilder segment(String... segments) throws IllegalArgumentException { if (segments == null) throw new IllegalArgumentException(Messages.MESSAGES.segmentsParameterNull()); for (String segment : segments) { if (segment == null) throw new IllegalArgumentException(Messages.MESSAGES.segmentNull()); path(Encode.encodePathSegment(segment)); } return this; }
@Override public UriBuilder path(Class resource, String method) throws IllegalArgumentException { if (resource == null) throw new IllegalArgumentException(Messages.MESSAGES.resourceNull()); if (method == null) throw new IllegalArgumentException(Messages.MESSAGES.methodNull()); Method theMethod = null; for (Method m : resource.getMethods()) { if (m.getName().equals(method)) { if (theMethod != null && m.isAnnotationPresent(Path.class)) { throw new IllegalArgumentException(Messages.MESSAGES.twoMethodsSameName(method)); } if (m.isAnnotationPresent(Path.class)) theMethod = m; } } if (theMethod == null) throw new IllegalArgumentException(Messages.MESSAGES.noPublicPathAnnotatedMethod(resource.getName(), method)); return path(theMethod); }