ilog.rules.brl.value.descriptor

Class IlrValueDescriptorFactory

  • java.lang.Object
    • ilog.rules.brl.value.descriptor.IlrValueDescriptorFactory


  • public abstract class IlrValueDescriptorFactory
    extends java.lang.Object
    Allows you to retrieve a value descriptor according to a unique key representing it. The value descriptor factory is a hierarchy of factories. The root factory by default tries to interpret the key as a class name. It tries to load and instantiate 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.vocabulary.model.IlrConcept. The default factory can be extended in order to load a value descriptor in a different way.
    See Also:
    IlrConcept
    • Constructor Detail

      • IlrValueDescriptorFactory

        protected IlrValueDescriptorFactory(IlrValueDescriptorFactory parent)
        Constructs a value descriptor 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 IlrValueDescriptorFactory getFactory()
        Returns the current value descriptor factory.
        Returns:
        The current value descriptor factory.
      • setFactory

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

        protected static IlrValueDescriptor createValueDescriptor(java.lang.String key,
                                               IlrConcept concept,
                                               java.lang.Class descClass)
        Creates a value descriptor. By default, tries to instantiate the class and throws a constructor with one parameter of type ilog.rules.vocabulary.model.IlrConcept.
        Parameters:
        key - The key of the value descriptor.
        concept - The concept associated to the value descriptor .
        descClass - The class to instantiate.
        Returns:
        The instance of the value descriptor 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 class loader given in parameter and after in the IlrValueDescriptorFactory class loader.
        Parameters:
        className - The class name
        classLoader - The class loader into which the class is loaded.
        Returns:
        The class according to the class name or null if the class does not exist.
      • loadValueDescriptor

        protected abstract IlrValueDescriptor loadValueDescriptor(java.lang.String key,
                                             IlrConcept concept,
                                             java.lang.ClassLoader classLoader,
                                             IlrVocabulary vocabulary)
        Load a value descriptor according to the key that define that value descriptor. According to the factory implementation.
        Parameters:
        key - The key that represent the value descriptor
        concept - The associated concept
        classLoader - The class loader
        vocabulary - The vocabulary
        Returns:
        The instance of the value descriptor defined by the key
      • findValueDescriptor

        public static IlrValueDescriptor findValueDescriptor(java.lang.String key,
                                             IlrConcept concept,
                                             java.lang.ClassLoader classLoader,
                                             IlrVocabulary vocabulary)
        Tries to load a value descriptor into the value descriptor hierarchy according to the key for that value descriptor.
        Parameters:
        key - The key that represents the value descriptor. An error is logged if the value descriptor is not found.
        concept - The associated concept.
        classLoader - The class loader.
        vocabulary - The vocabulary.
        Returns:
        The instance of the value descriptor defined by the key or null if the value descriptor is not found.
      • findValueDescriptor

        public static IlrValueDescriptor findValueDescriptor(java.lang.String key,
                                             IlrConcept concept,
                                             java.lang.ClassLoader classLoader,
                                             IlrVocabulary vocabulary,
                                             boolean logError)
        Tries to load a value descriptor into the value descriptor hierarchy according to the key for that value descriptor.
        Parameters:
        key - The key that represents the value descriptor.
        concept - The associated concept.
        classLoader - The class loader.
        vocabulary - The vocabulary.
        logError - true to log an error if the value descriptor is not found in the factory hierarchy
        Returns:
        The instance of the value descriptor defined by the key.

© Copyright IBM Corp. 1987, 2017