public ResourceDocType createResourceDocType() { return new ResourceDocType(); }
private String getSourceName(AnnotationDocType annotationDocType ) { if ( annotationDocType.hasAttributeDocs() ) { for ( NamedValueType namedValueType : annotationDocType.getAttributeDocs() ) { /* the value of the "value"-attribute is the param.sourceName... */ if ( "value".equals( namedValueType.getName() ) ) { return namedValueType.getValue(); } } } return null; }
public RepresentationDocType getRequestRepresentation( Class<?> resourceClass, Method method, String mediaType ) { if ( mediaType == null ) { return null; } final MethodDocType methodDoc = getMethodDoc( resourceClass, method ); return methodDoc != null && methodDoc.getRequestDoc() != null && methodDoc.getRequestDoc().getRepresentationDoc() != null // && mediaType.equals( methodDoc.getRequestDoc().getRepresentationDoc().getMediaType() ) ? methodDoc.getRequestDoc().getRepresentationDoc() : null; }
final ResponseDocType responseDoc = resourceDoc.getResponse( r.getResourceClass(), m.getMethod() ); List<Response> responses = new ArrayList<Response>(); if ( responseDoc != null && responseDoc.hasRepresentations() ) { for ( RepresentationDocType representationDoc : responseDoc.getRepresentations() ) { Response response = new Response(); wadlRepresentation.setElement( representationDoc.getElement() ); wadlRepresentation.setMediaType( representationDoc.getMediaType() ); addDocForExample( wadlRepresentation.getDoc(), representationDoc.getExample() ); addDoc( wadlRepresentation.getDoc(), representationDoc.getDoc() ); response.getStatus().add(representationDoc.getStatus()); response.getRepresentation().add(wadlRepresentation); if (!responseDoc.getWadlParams().isEmpty() ) { for ( WadlParamType wadlParamType : responseDoc.getWadlParams() ) { final Param param = new Param(); param.setName( wadlParamType.getName() ); param.setStyle( ParamStyle.fromValue( wadlParamType.getStyle() ) ); param.setType( wadlParamType.getType() ); addDoc( param.getDoc(), wadlParamType.getDoc() ); for(Response response : responses) { response.getParam().add(param); if (!isEmpty( responseDoc.getReturnDoc() ) ) { for(Response response : responses) { addDoc( response.getDoc(), responseDoc.getReturnDoc() );
public ClassDocType getClassDoc( Class<?> resourceClass ) { for ( ClassDocType classDocType : _resourceDoc.getDocs() ) { if( resourceClass.getName().equals( classDocType.getClassName() ) ) { return classDocType; } } return null; }
public MethodDocType getMethodDoc( Class<?> resourceClass, Method method ) { final ClassDocType classDoc = getClassDoc( resourceClass ); if ( classDoc != null ) { for ( MethodDocType methodDocType : classDoc.getMethodDocs() ) { if (method != null && method.getName().equals(methodDocType.getMethodName())) { return methodDocType; } } } return null; }
/** * * @param resourceClass * @param method * @param p * @return param doc type */ public ParamDocType getParamDoc( Class<?> resourceClass, Method method, Parameter p ) { final MethodDocType methodDoc = getMethodDoc( resourceClass, method ); if ( methodDoc != null ) { for ( ParamDocType paramDocType : methodDoc.getParamDocs() ) { for ( AnnotationDocType annotationDocType : paramDocType.getAnnotationDocs() ) { final Class<? extends Annotation> annotationType = p.getAnnotation().annotationType(); if ( annotationType != null ) { final String sourceName = getSourceName(annotationDocType); if ( sourceName != null && sourceName.equals( p.getSourceName() ) ) { return paramDocType; } } } } } return null; }
/** * @param r * @param m * @param mediaType * @return the enhanced {@link Representation} * @see com.sun.jersey.server.wadl.WadlGenerator#createRequestRepresentation(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod, javax.ws.rs.core.MediaType) */ public Representation createRequestRepresentation( AbstractResource r, AbstractResourceMethod m, MediaType mediaType ) { final Representation result = _delegate.createRequestRepresentation( r, m, mediaType ); final RepresentationDocType requestRepresentation = resourceDoc.getRequestRepresentation( r.getResourceClass(), m.getMethod(), result.getMediaType() ); if ( requestRepresentation != null ) { result.setElement( requestRepresentation.getElement() ); addDocForExample( result.getDoc(), requestRepresentation.getExample() ); } return result; }
public ResponseDocType getResponse( Class<?> resourceClass, Method method ) { final MethodDocType methodDoc = getMethodDoc( resourceClass, method ); return methodDoc != null && methodDoc.getResponseDoc() != null ? methodDoc.getResponseDoc() : null; }
/** * @param r * @param path * @return the enhanced {@link Resource} * @see com.sun.jersey.server.wadl.WadlGenerator#createResource(com.sun.jersey.api.model.AbstractResource, java.lang.String) */ public Resource createResource( AbstractResource r, String path ) { final Resource result = _delegate.createResource( r, path ); final ClassDocType classDoc = resourceDoc.getClassDoc( r.getResourceClass() ); if ( classDoc != null && !isEmpty( classDoc.getCommentText() ) ) { final Doc doc = new Doc(); doc.getContent().add( classDoc.getCommentText() ); result.getDoc().add( doc ); } return result; }
/** * @param r * @param m * @return the enhanced {@link Method} * @see com.sun.jersey.server.wadl.WadlGenerator#createMethod(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod) */ public Method createMethod( AbstractResource r, AbstractResourceMethod m ) { final Method result = _delegate.createMethod( r, m ); final MethodDocType methodDoc = resourceDoc.getMethodDoc( r.getResourceClass(), m.getMethod() ); if ( methodDoc != null && !isEmpty( methodDoc.getCommentText() ) ) { final Doc doc = new Doc(); doc.getContent().add( methodDoc.getCommentText() ); // doc.getOtherAttributes().put( new QName( "xmlns" ), "http://www.w3.org/1999/xhtml" ); result.getDoc().add( doc ); } return result; }
/** * @param r * @param m * @param p * @return the enhanced {@link Param} * @see com.sun.jersey.server.wadl.WadlGenerator#createParam(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractMethod, com.sun.jersey.api.model.Parameter) */ public Param createParam(AbstractResource r, AbstractMethod m, Parameter p) { final Param result = _delegate.createParam(r, m, p); if (result != null) { final ParamDocType paramDoc = resourceDoc.getParamDoc( r.getResourceClass(), (m == null ? null : m.getMethod()), p ); if(paramDoc != null && !isEmpty( paramDoc.getCommentText())) { final Doc doc = new Doc(); doc.getContent().add( paramDoc.getCommentText() ); result.getDoc().add( doc ); } } return result; }
private String getSourceName(AnnotationDocType annotationDocType ) { if ( annotationDocType.hasAttributeDocs() ) { for ( NamedValueType namedValueType : annotationDocType.getAttributeDocs() ) { /* the value of the "value"-attribute is the param.sourceName... */ if ( "value".equals( namedValueType.getName() ) ) { return namedValueType.getValue(); } } } return null; }
public ClassDocType getClassDoc( Class<?> resourceClass ) { for ( ClassDocType classDocType : _resourceDoc.getDocs() ) { if( resourceClass.getName().equals( classDocType.getClassName() ) ) { return classDocType; } } return null; }
public RepresentationDocType getRequestRepresentation( Class<?> resourceClass, Method method, String mediaType ) { if ( mediaType == null ) { return null; } final MethodDocType methodDoc = getMethodDoc( resourceClass, method ); return methodDoc != null && methodDoc.getRequestDoc() != null && methodDoc.getRequestDoc().getRepresentationDoc() != null // && mediaType.equals( methodDoc.getRequestDoc().getRepresentationDoc().getMediaType() ) ? methodDoc.getRequestDoc().getRepresentationDoc() : null; }
public ResourceDocType createResourceDocType() { return new ResourceDocType(); }
private String getSourceName(AnnotationDocType annotationDocType ) { if ( annotationDocType.hasAttributeDocs() ) { for ( NamedValueType namedValueType : annotationDocType.getAttributeDocs() ) { /* the value of the "value"-attribute is the param.sourceName... */ if ( "value".equals( namedValueType.getName() ) ) { return namedValueType.getValue(); } } } return null; }
public ClassDocType getClassDoc( Class<?> resourceClass ) { for ( ClassDocType classDocType : _resourceDoc.getDocs() ) { if( resourceClass.getName().equals( classDocType.getClassName() ) ) { return classDocType; } } return null; }
public RepresentationDocType getRequestRepresentation( Class<?> resourceClass, Method method, String mediaType ) { if ( mediaType == null ) { return null; } final MethodDocType methodDoc = getMethodDoc( resourceClass, method ); return methodDoc != null && methodDoc.getRequestDoc() != null && methodDoc.getRequestDoc().getRepresentationDoc() != null // && mediaType.equals( methodDoc.getRequestDoc().getRepresentationDoc().getMediaType() ) ? methodDoc.getRequestDoc().getRepresentationDoc() : null; }
public ResourceDocType createResourceDocType() { return new ResourceDocType(); }