ilog.rules.brl.value.editor

Class IlrValueEditorFactory

  • java.lang.Object
    • ilog.rules.brl.value.editor.IlrValueEditorFactory


  • public abstract class IlrValueEditorFactory
    extends java.lang.Object
    Provides the mechanism to retrieve a value editor with a unique key that represents the value editor. The value editor factory is a hierarchy of factories. By default, the root factory interprets the key as a class name. Then it loads and instantiates the class defined by the key. The class must have a public constructor with one parameter. The class of the parameter must be ilog.rules.brl.value.descriptor.IlrValueDescriptor. The default factory can be extended in order to load the value descriptor in a different way.
    See Also:
    IlrValueDescriptor
    • Constructor Detail

      • IlrValueEditorFactory

        protected IlrValueEditorFactory(IlrValueEditorFactory parent)
        Constructs a value editor factory with its parent factory.
        Parameters:
        parent - The parent factory.
    • Method Detail

      • getLogger

        public static IlrBRLLogger getLogger()
        This method retrieves a logger that may have been assigned to this factory. The logger is used to report errors while loading and instantiating value management classes.
        Returns:
        a logger associated to this factory
      • setLogger

        public static void setLogger(IlrBRLLogger log)
        This method allows setting a logger to this factory.
        Parameters:
        log - the logger to be associated to this factory.
      • getFactory

        public static IlrValueEditorFactory getFactory()
        Returns the current value editor factory.
        Returns:
        The current value editor factory.
      • setFactory

        public static void setFactory(IlrValueEditorFactory factory)
        Sets the new current factory.
        Parameters:
        factory - The new current factory.
      • createValueEditor

        protected static IlrValueEditor createValueEditor(java.lang.String key,
                                       IlrValueDescriptor valueDescriptor,
                                       java.lang.Class descClass)
        Creates a value editor. By default, tries to instantiate the class through a constructor with one parameter of class ilog.rules.brl.value.descriptor.IlrValueDescriptor.
        Parameters:
        key - The key of the value editor.
        valueDescriptor - The value descriptor associated with the value editor.
        descClass - The class to instantiate.
        Returns:
        The instance of the value editor defined by the key.
      • loadClass

        protected static java.lang.Class loadClass(java.lang.String className,
                                java.lang.ClassLoader classLoader)
        Tries to load a class before in the specified class loader and after in the IlrValueEditorFactory class loader.
        Parameters:
        className - The class name.
        classLoader - The class loader into which we try to load the class.
        Returns:
        The class according to the class name or null if the class does not exist.
      • loadValueEditor

        protected abstract IlrValueEditor loadValueEditor(java.lang.String key,
                                     IlrValueDescriptor valueDescriptor,
                                     java.lang.ClassLoader classLoader)
        Loads a value editor based on the key that defines that value editor according to the factory implementation.
        Parameters:
        key - The key that represent the value editor.
        valueDescriptor - The associated value descriptor.
        classLoader - The class loader.
        Returns:
        The instance of the value editor defined by the key.
      • findValueEditor

        public static IlrValueEditor findValueEditor(java.lang.String key,
                                     IlrValueDescriptor valueDescriptor,
                                     java.lang.ClassLoader classLoader)
        Loads a value editor into the value editor hierarchy, based on the key that defines that value editor.
        Parameters:
        key - The key that represents the value editor. An error is logged if the value editor is not found.
        valueDescriptor - The associated value descriptor.
        classLoader - The class loader.
        Returns:
        The instance of the value editor defined by the key.
      • findValueEditor

        public static IlrValueEditor findValueEditor(java.lang.String key,
                                     IlrValueDescriptor valueDescriptor,
                                     java.lang.ClassLoader classLoader,
                                     boolean logError)
        Loads a value editor into the value editor hierarchy, based on the key that defines that value editor.
        Parameters:
        key - The key that represents the value editor.
        valueDescriptor - The associated value descriptor.
        classLoader - The class loader.
        logError - true to log an error if the value editor is not found in the factory hierarchy
        Returns:
        The instance of the value editor defined by the key.
      • findValueEditor

        public static IlrValueEditor findValueEditor(java.lang.String key,
                                     IlrValueDescriptor valueDescriptor,
                                     java.lang.ClassLoader classLoader,
                                     IlrValueEditorFactory.UIPlatform platform)
        Loads a value editor into the value editor hierarchy, based on the key that defines that value editor. Search first for a specific UI platform, by suffixing the key with a dot and the name of the platform. And if a value editor is not found with a specific platform is not found search for a default platform without modifying the key.
        Parameters:
        key - The key that represents the value editor.
        valueDescriptor - The associated value descriptor.
        classLoader - The class loader.
        platform - The expected UI platform.
        Returns:
        The instance of the value editor defined by the key.
      • findValueEditor

        public static IlrValueEditor findValueEditor(java.lang.String key,
                                     IlrValueDescriptor valueDescriptor,
                                     java.lang.ClassLoader classLoader,
                                     IlrValueEditorFactory.UIPlatform platform,
                                     boolean logError)
        Loads a value editor into the value editor hierarchy, based on the key that defines that value editor. Search first for a specific UI platform, by suffixing the key with a dot and the name of the platform. And if a value editor is not found with a specific platform is not found search for a default platform without modifying the key.
        Parameters:
        key - The key that represents the value editor.
        valueDescriptor - The associated value descriptor.
        classLoader - The class loader.
        platform - The expected UI platform.
        logError - true to log an error if the value editor is not found in the factory hierarchy
        Returns:
        The instance of the value editor defined by the key.

© Copyright IBM Corp. 1987, 2017