Class ReporterFactory

  • All Implemented Interfaces:
    oracle.jdbc.internal.ObjectDataFactory, oracle.sql.ORADataFactory

    public final class ReporterFactory
    extends Object
    implements oracle.sql.ORADataFactory
    This class manages the instantiation of reporters. One can register a supplier method for a specific name which will then be callable via createReporter(name)

    Use the static createEmpty or createDefault methods to get a new instance. We don't allow direct instantiation because we want

    • Register default ReporterFactoryMethods for Core-Reporters
    • Be able to add more than one ReporterFactory implementation due to backwards-compatibility in future
    Author:
    pesse
    • Method Detail

      • createEmpty

        public static ReporterFactory createEmpty()
        Returns a new instance of an empty ReporterFactory with no registered ReporterFactoryMethods Normally, you should be using createDefault-method instead.
        Returns:
        a new ReporterFactory instance
      • createDefault

        public static ReporterFactory createDefault​(CompatibilityProxy proxy)
        Returns a new instance of a ReporterFactory with the default ReporterFactoryMethods registered. This can depend on the version of utPLSQL, therefore you have to provide a CompatibilityProxy
        Parameters:
        proxy - Compatibility proxy
        Returns:
        a new ReporterFactory instance with all default ReporterFactoryMethods registered
      • registerReporterFactoryMethod

        public ReporterFactory.ReporterFactoryMethodInfo registerReporterFactoryMethod​(String reporterName,
                                                                                       BiFunction<String,​Object[],​? extends Reporter> factoryMethod,
                                                                                       String description)
        Registers a creation method for a specified reporter name. Overrides eventually existing creation method
        Parameters:
        reporterName - the reporter's name to register
        factoryMethod - the method which will return the reporter
        description - the description of the reporter
        Returns:
        Object with information about the registered reporter
      • unregisterReporterFactoryMethod

        public ReporterFactory.ReporterFactoryMethodInfo unregisterReporterFactoryMethod​(String reporterName)
        Unregisters a specified reporter name.
        Parameters:
        reporterName - the reporter's name to unregister
        Returns:
        information about the reporter which was previously registered or null
      • hasRegisteredFactoryMethodFor

        public boolean hasRegisteredFactoryMethodFor​(String reporterName)
        Checks whether a given reporter has a registered FactoryMethod or not
        Parameters:
        reporterName - the reporter's name
        Returns:
        true or false
      • createReporter

        public Reporter createReporter​(String reporterName,
                                       @Nullable
                                       Object[] attributes)
        Returns a new reporter of the given name. If no specific ReporterFactoryMethod is registered, returns a default {Reporter}
        Parameters:
        reporterName - the reporter's name to create a new instance of
        attributes - attributes from STRUCT
        Returns:
        A reporter
      • createReporter

        public Reporter createReporter​(String reporterName)
        Returns a new reporter of the given name (or should do so). If no specific ReporterFactoryMethod is registered, returns a default {Reporter}
        Parameters:
        reporterName - Name of the reporter
        Returns:
        Reporter
      • getRegisteredReporterInfo

        public Map<String,​String> getRegisteredReporterInfo()
        Returns a set of all registered reporter's names
        Returns:
        Map of reporter names
      • create

        public oracle.sql.ORAData create​(oracle.sql.Datum d,
                                         int sqlType)
                                  throws SQLException
        Specified by:
        create in interface oracle.sql.ORADataFactory
        Throws:
        SQLException