This page shows one example of the generated report.
In this example the following enumeration types define codes:
Enum Type | Component Name | Code Start |
---|---|---|
MyCode | Test/My | 1000 |
HerCode | Test/Her | 1500 |
AnotherMyCode | ComponentA | 2000 |
The following folder structure is generated. Each code is specified in its own document.
This is the relevant contents of the enum type AnotherMyCode:
/** * Some other test codes. * <p> * More paragraphs. * </p> */ public enum AnotherMyCode implements NumberCode { /** * The only code in this codes. * * @sdoc.name Generic * @sdoc.tag one * @sdoc.tag two * @sdoc.sort-key 1 * @sdoc.short-description An optional <b>short</b> description. * @sdoc.notes Some notes on generic errors. */ @MessageParamsDescriptor(MyException.class) SOME(0); private AnotherMyCode(final Integer minorNumber) { this.info = new NumberCodeInfo("ComponentA", 2000, minorNumber); }
The contents of the associated properties file with the message templates.
2000.title=Some other problem 2000=This is the summary of some other problem. 2000.details=No details for the test.
This is the result of the XML export in the SDoc format.
<?xml version="1.0"?> <appcode xmlns="http://www.smartics.de/project/process/implementation/appcode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.smartics.de/project/process/implementation/appcode http://www.smartics.de/project/process/implementation/appcode"> <id>ComponentA-2000</id> <name>Generic</name> <type>error</type> <component>ComponentA</component> <implementation> <class>de.smartics.exceptions.sample.AnotherMyCode</class> <field>SOME</field> </implementation> <sort-key>1</sort-key> <tags> <tag>one</tag> <tag>two</tag> </tags> <short-description> An optional <b>short</b> description. </short-description> <package-description> Some other test codes. <p> More paragraphs. </p> </package-description> <description> The only code in this codes. <dl> </dl> </description> <notes>Some notes on generic errors.</notes> <messages> <message> <name>Title</name> <text>Some other problem</text> </message> <message> <name>Summary</name> <text>This is the summary of some other problem.</text> </message> <message> <name>Details</name> <text>No details for the test.</text> </message> </messages> </appcode>
This example shows, in addition to the previous one, that the field documentation of the exception is integrated into the report.
This is the relevant contents of the enum type AnotherMyCode:
/** * Test codes. */ @MessageParamsDescriptor(MyException.class) public enum MyCode implements NumberCode { // ***************************** Enumeration ****************************** /** * The zero code. */ ZERO(0); private MyCode(final Integer minorNumber) { this.info = new NumberCodeInfo("Test/My", 1000, minorNumber); }
The contents of the associated properties file with the message templates.
1000.title=Test Exception Zero 1000=The name is set to {1}. URL is ''{2}:{3}'': {0} 1000.details=No details for the test.
The relevant part form the associated MyException class:
@ParentMessageParam("cause=0:message") public class MyException extends BaseException { /** * The test URL. * * @serial */ @MessageParam("2:host,3:port") private final URL url;
And the super class:
public class BaseException extends AbstractLocalizedRuntimeException { /** * The name of the test exception. * * @serial */ @MessageParam("1") private final String name;
This is the result of the XML export in the SDoc format.
<?xml version="1.0"?> <appcode xmlns="http://www.smartics.de/project/process/implementation/appcode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.smartics.de/project/process/implementation/appcode http://www.smartics.de/project/process/implementation/appcode"> <id>Test/My-1000</id> <type>error</type> <component>Test/My</component> <implementation> <class>de.smartics.exceptions.sample.MyCode</class> <field>ZERO</field> </implementation> <short-description>The zero code</short-description> <package-description>Test codes.</package-description> <description>The zero code.</description> <messages> <message> <name>Title</name> <text>Test Exception Zero</text> </message> <message> <name>Summary</name> <text>The name is set to {name}. URL is '{url:host}:{url:port}': {cause:message}</text> <placeholders> <placeholder> <name>cause:message</name> <description>The root cause of the exception.</description> </placeholder> <placeholder> <name>name</name> <description>The name of the test exception.</description> </placeholder> <placeholder> <name>url:host</name> <description>The test URL.</description> </placeholder> <placeholder> <name>url:port</name> <description>The test URL.</description> </placeholder> </placeholders> </message> <message> <name>Details</name> <text>No details for the test.</text> </message> </messages> </appcode>