public abstract class AbstractWadlGeneratorGrammarGenerator<T> extends Object implements WadlGenerator
WadlGenerator generates a grammar based on the referenced
elements. This is a template class designed to be overridden by specific
implementations, for example XML Schema and JSON Schema
Created on: Sept 17, 2012| Modifier and Type | Class and Description |
|---|---|
protected static interface |
AbstractWadlGeneratorGrammarGenerator.HasType |
protected class |
AbstractWadlGeneratorGrammarGenerator.Pair |
protected static interface |
AbstractWadlGeneratorGrammarGenerator.WantsName<T> |
WadlGenerator.ExternalGrammarDefinition, WadlGenerator.Resolver| Modifier and Type | Field and Description |
|---|---|
protected List<AbstractWadlGeneratorGrammarGenerator.Pair> |
_hasTypeWantsName |
protected Class<T> |
_resolvedType |
protected URI |
_root |
protected Set<Class> |
_seeAlso |
protected URI |
_wadl |
static Set<Class> |
SPECIAL_GENERIC_TYPES |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractWadlGeneratorGrammarGenerator(WadlGenerator delegate,
Class<T> resolvedType) |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
acceptMediaType(javax.ws.rs.core.MediaType type) |
void |
attachTypes(ApplicationDescription introspector)
Process the elements in the WADL definition to attach schema types
as required.
|
protected abstract WadlGenerator.Resolver |
buildModelAndSchemas(Map<String,ApplicationDescription.ExternalGrammar> extraFiles)
Build the the external schema files and generate a suitable resolver
|
Application |
createApplication(javax.ws.rs.core.UriInfo requestInfo) |
WadlGenerator.ExternalGrammarDefinition |
createExternalGrammar()
Perform any post create functions such as generating grammars.
|
Method |
createMethod(AbstractResource ar,
AbstractResourceMethod arm) |
Param |
createParam(AbstractResource ar,
AbstractMethod am,
Parameter p) |
protected abstract AbstractWadlGeneratorGrammarGenerator.WantsName<T> |
createParmWantsName(Param param) |
protected abstract AbstractWadlGeneratorGrammarGenerator.WantsName<T> |
createRepresentationWantsName(Representation rt) |
Request |
createRequest(AbstractResource ar,
AbstractResourceMethod arm) |
Representation |
createRequestRepresentation(AbstractResource ar,
AbstractResourceMethod arm,
javax.ws.rs.core.MediaType mt) |
Resource |
createResource(AbstractResource ar,
String path) |
Resources |
createResources() |
List<Response> |
createResponses(AbstractResource ar,
AbstractResourceMethod arm) |
String |
getRequiredJaxbContextPath()
The jaxb context path that is used when the generated wadl application is marshalled
to a file.
This method is used in a decorator like manner. The result return the path (or a colon-separated list of package names) containing jaxb-beans that are added to wadl elements by this WadlGenerator, additionally to the context path of the decorated WadlGenerator (set by WadlGenerator.setWadlGeneratorDelegate(WadlGenerator).If you do not use custom jaxb beans, then simply return _delegate.getRequiredJaxbContextPath(),
otherwise return the delegate's WadlGenerator.getRequiredJaxbContextPath() together with
your required context path (separated by a colon): |
void |
init()
Invoked before all methods related to wadl-building are invoked.
|
protected static AbstractWadlGeneratorGrammarGenerator.HasType |
parameter(Parameter param,
javax.ws.rs.core.MediaType mt) |
void |
setWadlGeneratorDelegate(WadlGenerator delegate)
Sets the delegate that is decorated by this wadl generator.
|
protected List<AbstractWadlGeneratorGrammarGenerator.Pair> _hasTypeWantsName
protected URI _root
protected URI _wadl
protected AbstractWadlGeneratorGrammarGenerator(WadlGenerator delegate, Class<T> resolvedType)
protected static AbstractWadlGeneratorGrammarGenerator.HasType parameter(Parameter param, javax.ws.rs.core.MediaType mt)
param - parameter.public void setWadlGeneratorDelegate(WadlGenerator delegate)
WadlGeneratorWadlGenerator.init() or any setter method is invoked.setWadlGeneratorDelegate in interface WadlGeneratordelegate - the wadl generator to decoratepublic String getRequiredJaxbContextPath()
WadlGeneratorWadlGenerator.setWadlGeneratorDelegate(WadlGenerator)._delegate.getRequiredJaxbContextPath(),
otherwise return the delegate's WadlGenerator.getRequiredJaxbContextPath() together with
your required context path (separated by a colon):_delegate.getRequiredJaxbContextPath() == null
? ${yourContextPath}
: _delegate.getRequiredJaxbContextPath() + ":" + ${yourContextPath};
If you add the path for your custom jaxb beans, don't forget to add an
ObjectFactory (annotated with XmlRegistry) to this package.getRequiredJaxbContextPath in interface WadlGeneratorWadlGenerator.getRequiredJaxbContextPath() of the delegate or the
WadlGenerator.getRequiredJaxbContextPath() + ":" + ${yourContextPath}.public void init()
throws Exception
WadlGeneratorthis.delegate.init().init in interface WadlGeneratorExceptionpublic abstract boolean acceptMediaType(javax.ws.rs.core.MediaType type)
type - public Application createApplication(javax.ws.rs.core.UriInfo requestInfo)
createApplication in interface WadlGeneratorcom.sun.jersey.server.wadl.WadlGenerator#createApplication()public Method createMethod(AbstractResource ar, AbstractResourceMethod arm)
createMethod in interface WadlGeneratorar - abstract resourcearm - abstract resource methodWadlGenerator.createMethod(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod)public Request createRequest(AbstractResource ar, AbstractResourceMethod arm)
createRequest in interface WadlGeneratorar - abstract resourcearm - abstract resource methodWadlGenerator.createRequest(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod)public Param createParam(AbstractResource ar, AbstractMethod am, Parameter p)
createParam in interface WadlGeneratorar - abstract resourceam - abstract methodp - parameterWadlGenerator.createParam(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractMethod, com.sun.jersey.api.model.Parameter)public Representation createRequestRepresentation(AbstractResource ar, AbstractResourceMethod arm, javax.ws.rs.core.MediaType mt)
createRequestRepresentation in interface WadlGeneratorar - abstract resourcearm - abstract resource methodmt - media typeWadlGenerator.createRequestRepresentation(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod, javax.ws.rs.core.MediaType)public Resource createResource(AbstractResource ar, String path)
createResource in interface WadlGeneratorar - abstract resourcepath - resources pathWadlGenerator.createResource(com.sun.jersey.api.model.AbstractResource, java.lang.String)public Resources createResources()
createResources in interface WadlGeneratorWadlGenerator.createResources()public List<Response> createResponses(AbstractResource ar, AbstractResourceMethod arm)
createResponses in interface WadlGeneratorar - abstract resourcearm - abstract resource methodWadlGenerator.createResponses(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod)public WadlGenerator.ExternalGrammarDefinition createExternalGrammar()
WadlGeneratorcreateExternalGrammar in interface WadlGeneratorprotected abstract WadlGenerator.Resolver buildModelAndSchemas(Map<String,ApplicationDescription.ExternalGrammar> extraFiles)
extraFiles - public void attachTypes(ApplicationDescription introspector)
WadlGeneratorattachTypes in interface WadlGeneratorintrospector - The root description used to resolve these entriesprotected abstract AbstractWadlGeneratorGrammarGenerator.WantsName<T> createParmWantsName(Param param)
protected abstract AbstractWadlGeneratorGrammarGenerator.WantsName<T> createRepresentationWantsName(Representation rt)
Copyright © 2014 Oracle Corporation. All rights reserved.