@Override public String getConstraints() { return delegate.getConstraints(); }
@Override public String getName() { return delegate.getName(); }
@Override public <A extends Annotation> A getAnnotation(Class<A> annotationType) { return this.delegate.getAnnotation(annotationType); }
public Object exec(List list) throws TemplateModelException { if (list.size() < 1) { throw new TemplateModelException("The uniqueMediaTypesFor method must have a parameter."); } TemplateModel from = (TemplateModel) list.get(0); Object unwrapped = new BeansWrapperBuilder(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS).build().unwrap(from); Map<String, Parameter> uniquePathParams = new HashMap<String, Parameter>(); if (unwrapped instanceof Resource) { Resource entity = (Resource) unwrapped; List<? extends Method> methods = entity.getMethods(); if (methods != null) { for (Method method : methods) { List<? extends Parameter> params = method.getParameters(); if (params != null) { for (Parameter param : params) { if (param.getTypeLabel().equals("path")) { uniquePathParams.put(param.getName(), param); } } } } } } return uniquePathParams.values(); } }
public Object exec(List list) throws TemplateModelException { if (list.size() < 1) { throw new TemplateModelException("The responsesOf method must have a parameter."); } TemplateModel from = (TemplateModel) list.get(0); Object unwrapped = new BeansWrapperBuilder(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS).build().unwrap(from); if (unwrapped instanceof Method) { Method method = (Method) unwrapped; ArrayList<Parameter> params = new ArrayList<Parameter>(); for (Parameter parameter : method.getParameters()) { String type = parameter.getTypeLabel().toLowerCase(); if (type.contains("path")) { params.add(new SwaggerParameter(parameter, "path")); } else if (type.contains("form")) { params.add(new SwaggerParameter(parameter, "formData")); } else if (type.contains("query")) { params.add(new SwaggerParameter(parameter, "query")); } else if (type.contains("header")) { params.add(new SwaggerParameter(parameter, "header")); } } return params; } throw new TemplateModelException("No parameters for: " + unwrapped); }
@Override public Map<String, AnnotationMirror> getAnnotations() { return this.delegate.getAnnotations(); }
@Override public JavaDoc getJavaDoc() { return this.delegate.getJavaDoc(); }
@Override public String getDescription() { return delegate.getDescription(); }
@Override public Set<String> getConstraintValues() { return delegate.getConstraintValues(); }
@Override public String getDefaultValue() { return delegate.getDefaultValue(); }
public Object exec(List list) throws TemplateModelException { if (list.size() < 1) { throw new TemplateModelException("The uniqueMediaTypesFor method must have a parameter."); } TemplateModel from = (TemplateModel) list.get(0); Object unwrapped = new BeansWrapperBuilder(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS).build().unwrap(from); Map<String, Parameter> uniquePathParams = new HashMap<String, Parameter>(); if (unwrapped instanceof Resource) { Resource entity = (Resource) unwrapped; List<? extends Method> methods = entity.getMethods(); if (methods != null) { for (Method method : methods) { List<? extends Parameter> params = method.getParameters(); if (params != null) { for (Parameter param : params) { if (param.getTypeLabel().equals("path")) { uniquePathParams.put(param.getName(), param); } } } } } } return uniquePathParams.values(); } }
@Override public boolean isHasParameterConstraints() { for (Parameter parameter : getParameters()) { if (parameter.getConstraints() != null) { return true; } } return false; }
@Override public boolean isHasParameterConstraints() { for (Parameter parameter : getParameters()) { if (parameter.getConstraints() != null) { return true; } } return false; }