A single point for generating every reports implemented in this package.
Usage example:
Properties props = new Properties();
props.setProperty("PRODUCT.NAME", "MyProduct");
props.setProperty("PRODUCT.URL", "http://www.myproject.org");
Reports reports = new Reports(props);
reports.addAll(MathTransformFactory.class);
reports.write(new File("my-output-directory"));
- Since:
- 3.1
-
Field Summary
Fields inherited from class Report
properties
-
Constructor Summary
ConstructorDescriptionReports
(Properties properties) Creates a new report generator using the given property values. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds every kind of report applicable to the given factory.boolean
addAll()
Adds every kinds of report applicable to every factories of known class found on the classpath.boolean
Adds every kinds of report applicable to every factories of the given class found on the classpath.protected <T extends Report>
TcreateReport
(Class<T> type) Invoked whenReports
need to create a new instance of the given class.Writes in the given directory every reports added to thisReports
instance.
-
Constructor Details
-
Reports
Creates a new report generator using the given property values. See theReport
Javadoc for a list of expected values.- Parameters:
properties
- the property values, ornull
for the default values.
-
-
Method Details
-
add
Adds every kind of report applicable to the given factory. The kind of reports will be determined from the type of the provided factory. The current implementation can handle the following kind of factories:CRSAuthorityFactory
, given toAuthorityCodesReport
MathTransformFactory
, given toOperationParametersReport
- Parameters:
factory
- the factory for which to generate a report.type
- the factory type, usuallyfactory.getClass()
.- Returns:
true
if this method will generate a report for the given factory, orfalse
if the factory has been ignored.- Throws:
FactoryException
- if an error occurred while querying the factory.
-
addAll
Adds every kinds of report applicable to every factories of the given class found on the classpath. This method scans the classpath for factories in the way documented in theTestCase.factories(Class[])
method. For each instance found,add(Factory, Class)
is invoked.- Parameters:
type
- the kind of factories to add.- Returns:
true
if this method will generate at least one report for the factories of the given type, orfalse
otherwise.- Throws:
FactoryException
- if an error occurred while querying the factories.
-
addAll
Adds every kinds of report applicable to every factories of known class found on the classpath. This method scans the classpath for factories in the way documented in theTestCase.factories(Class[])
method. For each instance found,add(Factory, Class)
is invoked.- Returns:
true
if this method will generate at least one report, orfalse
otherwise.- Throws:
FactoryException
- if an error occurred while querying the factories.
-
createReport
Invoked whenReports
need to create a new instance of the given class. Subclasses can override this method in order to customize theirReport
instances.The default implementation creates a new instance of the given classes using the reflection API. The given type shall declare a public constructor expecting a single
Properties
argument.- Type Parameters:
T
- the compile-time type of thetype
argument.- Parameters:
type
- the kind of report to create.- Returns:
- the report of the given type, or
null
if no report of the given type should be generated. - Throws:
IllegalArgumentException
- if the given type is not a kind of report that this method can instantiate.
-
write
Writes in the given directory every reports added to thisReports
instance.- Specified by:
write
in classReport
- Parameters:
directory
- the directory where to write the reports.- Returns:
- the index file, or the main file in only one report has been created,
or
null
if no report has been created. - Throws:
IOException
- if an error occurred while writing a report.
-