Object
Report
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
    boolean
    add(Factory factory, Class<? extends Factory> type)
    Adds every kind of report applicable to the given factory.
    boolean
    Adds every kinds of report applicable to every factories of known class found on the classpath.
    boolean
    addAll(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>
    T
    Invoked when Reports need to create a new instance of the given class.
    write(File directory)
    Writes in the given directory every reports added to this Reports instance.

    Methods inherited from class Report

    getLocale, progress

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Reports

      public Reports(Properties properties)
      Creates a new report generator using the given property values. See the Report Javadoc for a list of expected values.
      Parameters:
      properties - the property values, or null for the default values.
  • Method Details

    • 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:
      Parameters:
      factory - the factory for which to generate a report.
      type - the factory type, usually factory.getClass().
      Returns:
      true if this method will generate a report for the given factory, or false if 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 the TestCase.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, or false otherwise.
      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 the TestCase.factories(Class[]) method. For each instance found, add(Factory, Class) is invoked.
      Returns:
      true if this method will generate at least one report, or false otherwise.
      Throws:
      FactoryException - if an error occurred while querying the factories.
    • createReport

      protected <T extends Report> T createReport(Class<T> type) throws IllegalArgumentException
      Invoked when Reports need to create a new instance of the given class. Subclasses can override this method in order to customize their Report 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 the type 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

      public File write(File directory) throws IOException
      Writes in the given directory every reports added to this Reports instance.
      Specified by:
      write in class Report
      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.