Package org.opengis.test.report
Class Reports
-
public class Reports extends Report
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
Constructors Constructor Description Reports(Properties properties)Creates a new report generator using the given property values.
-
Method Summary
Modifier and Type Method Description booleanadd(Factory factory, Class<? extends Factory> type)Adds every kind of report applicable to the given factory.booleanaddAll()Adds every kinds of report applicable to every factories of known class found on the classpath.booleanaddAll(Class<? extends Factory> type)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 whenReportsneed to create a new instance of the given class.Filewrite(File directory)Writes in the given directory every reports added to thisReportsinstance.
-
-
-
Constructor Detail
-
Reports
public Reports(Properties properties)
Creates a new report generator using the given property values. See theReportJavadoc for a list of expected values.- Parameters:
properties- the property values, ornullfor the default values.
-
-
Method Detail
-
add
public boolean add(Factory factory, Class<? extends Factory> type) throws FactoryException
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 toAuthorityCodesReportMathTransformFactory, given toOperationParametersReport
- Parameters:
factory- the factory for which to generate a report.type- the factory type, usuallyfactory.getClass().- Returns:
trueif this method will generate a report for the given factory, orfalseif the factory has been ignored.- Throws:
FactoryException- if an error occurred while querying the factory.
-
addAll
public boolean addAll(Class<? extends Factory> type) throws FactoryException
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:
trueif this method will generate at least one report for the factories of the given type, orfalseotherwise.- Throws:
FactoryException- if an error occurred while querying the factories.
-
addAll
public boolean addAll() throws FactoryException
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:
trueif this method will generate at least one report, orfalseotherwise.- Throws:
FactoryException- if an error occurred while querying the factories.
-
createReport
protected <T extends Report> T createReport(Class<T> type) throws IllegalArgumentException
Invoked whenReportsneed to create a new instance of the given class. Subclasses can override this method in order to customize theirReportinstances.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
Propertiesargument.- Type Parameters:
T- the compile-time type of thetypeargument.- Parameters:
type- the kind of report to create.- Returns:
- the report of the given type, or
nullif 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
public File write(File directory) throws IOException
Writes in the given directory every reports added to thisReportsinstance.- Specified by:
writein 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
nullif no report has been created. - Throws:
IOException- if an error occurred while writing a report.
-
-