@Test public void wadlIsGeneratedWithUnknownCustomParameterAnnotation() throws JAXBException, PrivilegedActionException { ClassDocType cdt = new ClassDocType(); cdt.setClassName(TestResource.class.getName()); MethodDocType mdt = new MethodDocType(); mdt.setMethodName("method"); cdt.getMethodDocs().add(mdt); ParamDocType pdt = new ParamDocType("x", "comment about x"); mdt.getParamDocs().add(pdt); AnnotationDocType adt = new AnnotationDocType(); adt.setAnnotationTypeName(CustomParam.class.getName()); adt.getAttributeDocs().add(new NamedValueType("value", "x")); pdt.getAnnotationDocs().add(adt); ResourceDocType rdt = new ResourceDocType(); rdt.getDocs().add(cdt); WadlGenerator wg = new WadlGeneratorResourceDocSupport(new WadlGeneratorImpl(), rdt); WadlBuilder wb = new WadlBuilder(wg); AbstractResource resource = IntrospectionModeller.createResource(TestResource.class); ApplicationDescription app = wb.generate(null,null,null, Collections.singleton(resource)); StringWriter sw = new StringWriter(); JAXBContext context = AccessController.doPrivileged(new PrivilegedExceptionAction<JAXBContext>(){ @Override public JAXBContext run() throws JAXBException { return JAXBContext.newInstance(Application.class); } }); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(app.getApplication(), sw); }
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; }
WadlGeneratorResourceDocSupport implements WadlGenerator { 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; } }
WadlGeneratorResourceDocSupport implements WadlGenerator { 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; } WadlGeneratorResourceDocSupport();  WadlGeneratorResourceDocSupport( WadlGenerator wadlGenerator, ResourceDocType resourceDoc ); }
WadlGeneratorResourceDocSupport implements WadlGenerator { 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; } WadlGeneratorResourceDocSupport();  WadlGeneratorResourceDocSupport( WadlGenerator wadlGenerator, ResourceDocType resourceDoc ); void setWadlGeneratorDelegate( WadlGenerator delegate ); @Override void setEnvironment(Environment env); void setResourceDocFile( File resourceDocFile ); void setResourceDocStream( InputStream resourceDocStream ); void init(); String getRequiredJaxbContextPath(); Application createApplication(UriInfo requestInfo); Resource createResource( AbstractResource r, String path ); Method createMethod( AbstractResource r, AbstractResourceMethod m ); Representation createRequestRepresentation( AbstractResource r,
                                                       AbstractResourceMethod m, MediaType mediaType ); Request createRequest( AbstractResource r, AbstractResourceMethod m ); List<Response> createResponses( AbstractResource r, AbstractResourceMethod m ); Param createParam(AbstractResource r,
                             AbstractMethod m, Parameter p); Resources createResources(); @Override ExternalGrammarDefinition createExternalGrammar(); @Override void attachTypes(ApplicationDescription egd); }
WadlGeneratorResourceDocSupport implements WadlGenerator { 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; } WadlGeneratorResourceDocSupport();  WadlGeneratorResourceDocSupport( WadlGenerator wadlGenerator, ResourceDocType resourceDoc ); void setWadlGeneratorDelegate( WadlGenerator delegate ); @Override void setEnvironment(Environment env); void setResourceDocFile( File resourceDocFile ); void setResourceDocStream( InputStream resourceDocStream ); void init(); String getRequiredJaxbContextPath(); Application createApplication(UriInfo requestInfo); Resource createResource( AbstractResource r, String path ); Method createMethod( AbstractResource r, AbstractResourceMethod m ); Representation createRequestRepresentation( AbstractResource r,
                                                       AbstractResourceMethod m, MediaType mediaType ); Request createRequest( AbstractResource r, AbstractResourceMethod m ); List<Response> createResponses( AbstractResource r, AbstractResourceMethod m ); Param createParam(AbstractResource r,
                             AbstractMethod m, Parameter p); Resources createResources(); @Override ExternalGrammarDefinition createExternalGrammar(); @Override void attachTypes(ApplicationDescription egd);  }