public HardCodedTarget(Class<T> type, String name, String url) { this.type = checkNotNull(type, "type"); this.name = checkNotNull(emptyToNull(name), "name"); this.url = checkNotNull(emptyToNull(url), "url"); }
EmptyTarget(Class<T> type, String name) { this.type = checkNotNull(type, "type"); this.name = checkNotNull(emptyToNull(name), "name"); }
private void parseProduces(MethodMetadata md, Method method, RequestMapping annotation) { String[] serverProduces = annotation.produces(); String clientAccepts = serverProduces.length == 0 ? null : emptyToNull(serverProduces[0]); if (clientAccepts != null) { md.template().header(ACCEPT, clientAccepts); } }
private void parseConsumes(MethodMetadata md, Method method, RequestMapping annotation) { String[] serverConsumes = annotation.consumes(); String clientProduces = serverConsumes.length == 0 ? null : emptyToNull(serverConsumes[0]); if (clientProduces != null) { md.template().header(CONTENT_TYPE, clientProduces); } }
private void parseProduces(MethodMetadata md, Method method, RequestMapping annotation) { String[] serverProduces = annotation.produces(); String clientAccepts = serverProduces.length == 0 ? null : emptyToNull(serverProduces[0]); if (clientAccepts != null) { md.template().header(ACCEPT, clientAccepts); } }
private void parseProduces(MethodMetadata md, Method method, RequestMapping annotation) { String[] serverProduces = annotation.produces(); String clientAccepts = serverProduces.length == 0 ? null : emptyToNull(serverProduces[0]); if (clientAccepts != null) { md.template().header(ACCEPT, clientAccepts); } }
private void parseConsumes(MethodMetadata md, Method method, RequestMapping annotation) { String[] serverConsumes = annotation.consumes(); String clientProduces = serverConsumes.length == 0 ? null : emptyToNull(serverConsumes[0]); if (clientProduces != null) { md.template().header(CONTENT_TYPE, clientProduces); } }
private void parseProduces(MethodMetadata md, Method method, RequestMapping annotation) { String[] serverProduces = annotation.produces(); String clientAccepts = serverProduces.length == 0 ? null : emptyToNull(serverProduces[0]); if (clientAccepts != null) { md.template().header(ACCEPT, clientAccepts); } }
private void parseConsumes(MethodMetadata md, Method method, RequestMapping annotation) { String[] serverConsumes = annotation.consumes(); String clientProduces = serverConsumes.length == 0 ? null : emptyToNull(serverConsumes[0]); if (clientProduces != null) { md.template().header(CONTENT_TYPE, clientProduces); } }
private void parseConsumes(MethodMetadata md, Method method, RequestMapping annotation) { String[] serverConsumes = annotation.consumes(); String clientProduces = serverConsumes.length == 0 ? null : emptyToNull(serverConsumes[0]); if (clientProduces != null) { md.template().header(CONTENT_TYPE, clientProduces); } }
@Override protected void processAnnotationOnClass(MethodMetadata data, Class<?> clz) { if (clz.getInterfaces().length == 0) { RequestMapping classAnnotation = findMergedAnnotation(clz, RequestMapping.class); if (classAnnotation != null) { // Prepend path from class annotation if specified if (classAnnotation.value().length > 0) { String pathValue = emptyToNull(classAnnotation.value()[0]); pathValue = resolve(pathValue); if (!pathValue.startsWith("/")) { pathValue = "/" + pathValue; } data.template().uri(pathValue); } } } }
@Override protected void processAnnotationOnClass(MethodMetadata data, Class<?> clz) { if (clz.getInterfaces().length == 0) { RequestMapping classAnnotation = findMergedAnnotation(clz, RequestMapping.class); if (classAnnotation != null) { // Prepend path from class annotation if specified if (classAnnotation.value().length > 0) { String pathValue = emptyToNull(classAnnotation.value()[0]); pathValue = resolve(pathValue); if (!pathValue.startsWith("/")) { pathValue = "/" + pathValue; } data.template().uri(pathValue); } } } }
@Override protected void processAnnotationOnClass(MethodMetadata data, Class<?> clz) { if (clz.getInterfaces().length == 0) { RequestMapping classAnnotation = findMergedAnnotation(clz, RequestMapping.class); if (classAnnotation != null) { // Prepend path from class annotation if specified if (classAnnotation.value().length > 0) { String pathValue = emptyToNull(classAnnotation.value()[0]); pathValue = resolve(pathValue); if (!pathValue.startsWith("/")) { pathValue = "/" + pathValue; } data.template().insert(0, pathValue); } } } }
private void handleProducesAnnotation(MethodMetadata data, Produces produces, String name) { String[] serverProduces = produces.value(); String clientAccepts = serverProduces.length == 0 ? null : emptyToNull(serverProduces[0]); checkState(clientAccepts != null, "Produces.value() was empty on %s", name); data.template().header(ACCEPT, (String) null); // remove any previous produces data.template().header(ACCEPT, clientAccepts); }
private void handleConsumesAnnotation(MethodMetadata data, Consumes consumes, String name) { String[] serverConsumes = consumes.value(); String clientProduces = serverConsumes.length == 0 ? null : emptyToNull(serverConsumes[0]); checkState(clientProduces != null, "Consumes.value() was empty on %s", name); data.template().header(CONTENT_TYPE, (String) null); // remove any previous consumes data.template().header(CONTENT_TYPE, clientProduces); }
@Override public boolean processArgument(AnnotatedParameterContext context, Annotation annotation, Method method) { int parameterIndex = context.getParameterIndex(); Class<?> parameterType = method.getParameterTypes()[parameterIndex]; MethodMetadata data = context.getMethodMetadata(); if (Map.class.isAssignableFrom(parameterType)) { checkState(data.headerMapIndex() == null, "Header map can only be present once."); data.headerMapIndex(parameterIndex); return true; } String name = ANNOTATION.cast(annotation).value(); checkState(emptyToNull(name) != null, "RequestHeader.value() was empty on parameter %s", parameterIndex); context.setParameterName(name); Collection<String> header = context.setTemplateParameter(name, data.template().headers().get(name)); data.template().header(name, header); return true; } }
@Override public boolean processArgument(AnnotatedParameterContext context, Annotation annotation, Method method) { String name = ANNOTATION.cast(annotation).value(); checkState(emptyToNull(name) != null, "PathVariable annotation was empty on param %s.", context.getParameterIndex()); context.setParameterName(name); MethodMetadata data = context.getMethodMetadata(); String varName = '{' + name + '}'; if (!data.template().url().contains(varName) && !searchMapValues(data.template().queries(), varName) && !searchMapValues(data.template().headers(), varName)) { data.formParams().add(name); } return true; }
@Override public boolean processArgument(AnnotatedParameterContext context, Annotation annotation, Method method) { int parameterIndex = context.getParameterIndex(); Class<?> parameterType = method.getParameterTypes()[parameterIndex]; MethodMetadata data = context.getMethodMetadata(); if (Map.class.isAssignableFrom(parameterType)) { checkState(data.headerMapIndex() == null, "Header map can only be present once."); data.headerMapIndex(parameterIndex); return true; } String name = ANNOTATION.cast(annotation).value(); checkState(emptyToNull(name) != null, "RequestHeader.value() was empty on parameter %s", parameterIndex); context.setParameterName(name); Collection<String> header = context.setTemplateParameter(name, data.template().headers().get(name)); data.template().header(name, header); return true; } }
@Override public boolean processArgument(AnnotatedParameterContext context, Annotation annotation, Method method) { String name = ANNOTATION.cast(annotation).value(); checkState(emptyToNull(name) != null, "PathVariable annotation was empty on param %s.", context.getParameterIndex()); context.setParameterName(name); MethodMetadata data = context.getMethodMetadata(); String varName = '{' + name + '}'; if (!data.template().url().contains(varName) && !searchMapValues(data.template().queries(), varName) && !searchMapValues(data.template().headers(), varName)) { data.formParams().add(name); } return true; }
@Override public boolean processArgument(AnnotatedParameterContext context, Annotation annotation, Method method) { String name = ANNOTATION.cast(annotation).value(); checkState(emptyToNull(name) != null, "PathVariable annotation was empty on param %s.", context.getParameterIndex()); context.setParameterName(name); MethodMetadata data = context.getMethodMetadata(); String varName = '{' + name + '}'; if (!data.template().url().contains(varName) && !searchMapValues(data.template().queries(), varName) && !searchMapValues(data.template().headers(), varName)) { data.formParams().add(name); } return true; }