com.sun.jersey.api.wadl.config
Class WadlGeneratorConfig

java.lang.Object
  extended by com.sun.jersey.api.wadl.config.WadlGeneratorConfig

public abstract class WadlGeneratorConfig
extends java.lang.Object

Provides a configured WadlGenerator with all decorations (the default wadl generator decorated by other generators).

Creating a WadlGeneratorConfig

If you want to create an instance at runtime you can configure the WadlGenerator class and property names/values. A new instance of the Generator is created for each generation action. The first option would look like this:

WadlGeneratorConfig config = WadlGeneratorConfig
          .generator( MyWadlGenerator.class )
            .prop( "someProperty", "someValue" )
          .generator( MyWadlGenerator2.class )
            .prop( "someProperty", "someValue" )
            .prop( "anotherProperty", "anotherValue" )
          .build();
 

If you want to specify the WadlGeneratorConfig in the web.xml you have to subclass it and set the servlet init-param ResourceConfig.PROPERTY_WADL_GENERATOR_CONFIG to the name of your subclass. This class might look like this:
class MyWadlGeneratorConfig extends WadlGeneratorConfig {

        public List configure() {
            return generator( MyWadlGenerator.class )
                .prop( "foo", propValue )
              .generator( MyWadlGenerator2.class )
                .prop( "bar", propValue2 )
              .descriptions();
        }

    }
 

Configuring the WadlGenerator

The WadlGenerator properties will be populated with the provided properties like this:

Existing WadlGenerator implementations:

A common example for a WadlGeneratorConfig would be this:

class MyWadlGeneratorConfig extends WadlGeneratorConfig {

        public List configure() {
            return generator( WadlGeneratorApplicationDoc.class ) 
                .prop( "applicationDocsStream", "application-doc.xml" ) 
              .generator( WadlGeneratorGrammarsSupport.class ) 
                .prop( "grammarsStream", "application-grammars.xml" ) 
              .generator( WadlGeneratorResourceDocSupport.class ) 
                .prop( "resourceDocStream", "resourcedoc.xml" ) 
              .descriptions();
        }

    }
 

Version:
$Id: WadlGeneratorConfig.java 5180 2011-07-12 13:58:19Z gdavison $
Author:
Martin Grotzke

Nested Class Summary
static class WadlGeneratorConfig.WadlGeneratorConfigDescriptionBuilder
           
 
Constructor Summary
WadlGeneratorConfig()
           
 
Method Summary
abstract  java.util.List<WadlGeneratorDescription> configure()
           
 WadlGenerator createWadlGenerator()
          Create a new instance of WadlGenerator, based on the WadlGeneratorDescriptions provided by configure().
static WadlGeneratorConfig.WadlGeneratorConfigDescriptionBuilder generator(java.lang.Class<? extends WadlGenerator> generatorClass)
          Start to build an instance of WadlGeneratorConfig:
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WadlGeneratorConfig

public WadlGeneratorConfig()
Method Detail

configure

public abstract java.util.List<WadlGeneratorDescription> configure()

createWadlGenerator

public WadlGenerator createWadlGenerator()
Create a new instance of WadlGenerator, based on the WadlGeneratorDescriptions provided by configure().

Returns:
the initialized WadlGenerator

generator

public static WadlGeneratorConfig.WadlGeneratorConfigDescriptionBuilder generator(java.lang.Class<? extends WadlGenerator> generatorClass)
Start to build an instance of WadlGeneratorConfig:
generator(<class>)
      .prop(<name>, <value>)
      .prop(<name>, <value>)
 .generator(<class>)
      .prop(<name>, <value>)
      .prop(<name>, <value>)
      .build()

Parameters:
generatorClass - the class of the wadl generator to configure
Returns:
an instance of WadlGeneratorConfig.WadlGeneratorConfigDescriptionBuilder.


Copyright © 2011 Oracle Corporation. All Rights Reserved.