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();
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 {@link WadlGenerator} properties will be populated with the provided properties like this:
org.example.Foo
and the provided property value is of type org.example.Foo
new File( generator.getClass().getResource( strippedFilename ).toURI() )
Notice that the filename is loaded from the classpath in this case, e.g. classpath:test.xml refers to a file in the package of the class ( {@link WadlGeneratorDescription#getGeneratorClass()}). The file reference classpath:/test.xml refers to a file that is in the root of the classpath. Existing {@link WadlGenerator} implementations:
A common example for a {@link 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(); } }
@author Martin Grotzke
@version $Id$
|
|
|
|
|
|
|
|