br.com.anteros.jsondoc.springmvc.scanner.builder.SpringResponseBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Anteros-JSONDoc-SpringMVC Show documentation
Show all versions of Anteros-JSONDoc-SpringMVC Show documentation
The support for Spring MVC of the jsondoc project.
The newest version!
package br.com.anteros.jsondoc.springmvc.scanner.builder;
import java.lang.reflect.Method;
import org.jsondoc.core.util.JSONDocType;
import org.jsondoc.core.util.JSONDocTypeBuilder;
import org.springframework.http.ResponseEntity;
import br.com.anteros.jsondoc.core.pojo.ApiResponseObjectDoc;
public class SpringResponseBuilder {
/**
* Builds the ApiResponseObjectDoc from the method's return type and checks if the first type corresponds to a ResponseEntity class. In that case removes the "responseentity"
* string from the final list because it's not important to the documentation user.
* @param method
* @param apiResponseObjectDoc
* @return
*/
public static ApiResponseObjectDoc buildResponse(Method method) {
ApiResponseObjectDoc apiResponseObjectDoc = new ApiResponseObjectDoc(JSONDocTypeBuilder.build(new JSONDocType(), method.getReturnType(), method.getGenericReturnType()));
if(method.getReturnType().isAssignableFrom(ResponseEntity.class)) {
apiResponseObjectDoc.getJsondocType().getType().remove(0);
}
return apiResponseObjectDoc;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy