use of com.sun.javadoc.Parameter in project jersey by jersey.
the class ResourceDoclet method addParamDocs.
private static void addParamDocs(final MethodDoc methodDoc, final MethodDocType methodDocType, final DocProcessor docProcessor) {
final Parameter[] parameters = methodDoc.parameters();
final ParamTag[] paramTags = methodDoc.paramTags();
/* only use both javadoc and reflection information when the number
* of params are the same
*/
if (parameters != null && paramTags != null && parameters.length == paramTags.length) {
for (int i = 0; i < parameters.length; i++) {
final Parameter parameter = parameters[i];
/* TODO: this only works if the params and tags are in the same
* order. If the param tags are mixed up, the comments for parameters
* will be wrong.
*/
final ParamTag paramTag = paramTags[i];
final ParamDocType paramDocType = new ParamDocType();
paramDocType.setParamName(paramTag.parameterName());
paramDocType.setCommentText(paramTag.parameterComment());
docProcessor.processParamTag(paramTag, parameter, paramDocType);
final AnnotationDesc[] annotations = parameter.annotations();
if (annotations != null) {
for (final AnnotationDesc annotationDesc : annotations) {
final AnnotationDocType annotationDocType = new AnnotationDocType();
final String typeName = annotationDesc.annotationType().qualifiedName();
annotationDocType.setAnnotationTypeName(typeName);
for (final ElementValuePair elementValuePair : annotationDesc.elementValues()) {
final NamedValueType namedValueType = new NamedValueType();
namedValueType.setName(elementValuePair.element().name());
namedValueType.setValue(elementValuePair.value().value().toString());
annotationDocType.getAttributeDocs().add(namedValueType);
}
paramDocType.getAnnotationDocs().add(annotationDocType);
}
}
methodDocType.getParamDocs().add(paramDocType);
}
}
}
use of com.sun.javadoc.Parameter in project RESTdoclet by IG-Group.
the class MethodBuilder method initRequestParams.
/**
* Initialises the request-parameters of this method.
*
* @param params the method's parameters.
* @param tags the parameters' Java documentation tags.
*/
private void initRequestParams(Method method, final Parameter[] params, final ParamTag[] tags) {
LOG.debug(method.getName());
ArrayList<RequestParameter> requestParams = new ArrayList<RequestParameter>();
for (Parameter param : params) {
if (isAnnotated(param, RequestParam.class)) {
requestParams.add(new RequestParameterBuilder().build(new RequestParameter(), param, tags));
}
}
method.setRequestParams(requestParams);
}
use of com.sun.javadoc.Parameter in project RESTdoclet by IG-Group.
the class MethodBuilder method initBodyParams.
/**
* Initialises the request body parameters of this method.
*
* @param params the method's parameters.
* @param tags the parameters' Java documentation tags.
*/
private void initBodyParams(Method method, final Parameter[] params, final ParamTag[] tags) {
LOG.debug(method.getName());
ArrayList<BodyParameter> bodyParams = new ArrayList<BodyParameter>();
for (Parameter param : params) {
if (isAnnotated(param, RequestBody.class)) {
LOG.debug("YYYYYYYYYYYYYYYYYY");
bodyParams.add(new BodyParameterBuilder().build(new BodyParameter(), param, tags));
}
}
method.setBodyParams(bodyParams);
}
use of com.sun.javadoc.Parameter in project jdk8u_jdk by JetBrains.
the class Util method getFriendlyUnqualifiedSignature.
/**
* Returns a reader-friendly string representation of the
* specified method's signature. Names of reference types are not
* package-qualified.
**/
static String getFriendlyUnqualifiedSignature(MethodDoc method) {
String sig = method.name() + "(";
Parameter[] parameters = method.parameters();
for (int i = 0; i < parameters.length; i++) {
if (i > 0) {
sig += ", ";
}
Type paramType = parameters[i].type();
sig += paramType.typeName() + paramType.dimension();
}
sig += ")";
return sig;
}
use of com.sun.javadoc.Parameter in project RESTdoclet by IG-Group.
the class MethodBuilder method initPathParams.
/**
* Initialises the path-parameters of this method.
*
* @param params the method's path parameters.
* @param tags the parameters' Java documentation tags.
*/
private void initPathParams(Method method, final Parameter[] params, final ParamTag[] tags) {
LOG.debug(method.getName());
ArrayList<PathParameter> pathParams = new ArrayList<PathParameter>();
for (Parameter param : params) {
if (isAnnotated(param, PathVariable.class)) {
pathParams.add(new PathParameterBuilder().build(new PathParameter(), param, tags));
}
}
method.setPathParams(pathParams);
}
Aggregations