ru.hts.springwebdoclet.annotation.parameter.RequestParamAnnotationHandler Maven / Gradle / Ivy
package ru.hts.springwebdoclet.annotation.parameter;
import com.sun.javadoc.AnnotationDesc;
import com.sun.javadoc.Parameter;
import org.springframework.web.bind.annotation.RequestParam;
import ru.hts.springwebdoclet.annotation.AnnotationHandler;
import ru.hts.springwebdoclet.render.RenderContext;
/**
* Processes @RequestParam
annotation
* @author Ivan Sungurov
*/
public class RequestParamAnnotationHandler implements AnnotationHandler {
@Override
public RenderContext handle(AnnotationDesc annotationDoc, Parameter parameter) {
RenderContext result = new RenderContext();
result.put("required", true);
for (AnnotationDesc.ElementValuePair annotationParam : annotationDoc.elementValues()) {
String annotationParamName = annotationParam.element().name();
Object value = annotationParam.value().value();
if ("value".equals(annotationParamName)) {
result.put("name", value);
} else if ("required".equals(annotationParamName)) {
result.put("required", value);
}
}
return result;
}
@Override
public Class getSupportedAnnotation() {
return RequestParam.class;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy