ilog.rules.factory

Class IlrReflect

  • All Implemented Interfaces:
    IlrObjectModel, IlrProperties, IlrTransientProperties, IlrMutableObjectModel, ilog.rules.factory.IlrDataAccessStrategy, IlrVisitable, java.io.Serializable


    public class IlrReflect
    extends IlrDynamicObjectModel
    implements ilog.rules.factory.IlrDataAccessStrategy, java.io.Serializable

    This class is the concrete implementation of the Execution Object Model (XOM). When rules are parsed, the rule parser finds class definitions in an instance of this class. While class construction and query APIs are inherited from its superclass, this class provides additional methods for handling the dynamic data binding feature.

    Since:
    JRules 3.5
    See Also:
    Serialized Form
    • Field Detail

      • factory

        public transient IlrFactory factory

        A factory builder. The role of this object is to build factory objects attached to a specific reflect object. When the reflect object is created, it automatically initializes this field.

    • Constructor Detail

      • IlrReflect

        public IlrReflect()

        Constructs a reflect object. Initially, the reflect object does not contain any classes. The resource bundle used to configure the engine is created using new IlrResources().

      • IlrReflect

        public IlrReflect(IlrResources resources)

        Constructs a reflect object. Initially, the reflect object does not contain any classes. The resource bundle used to configure the engine is passed as an argument.

        Parameters:
        resources - The engine configuration resource bundle.
    • Method Detail

      • writeModel

        public void writeModel(java.io.Writer writer)
                        throws java.io.IOException

        Writes the dynamic classes defined in this reflect object to a writer, using the BOM syntax.

        Throws:
        java.io.IOException - if any I/O exceptions have been caused by the passed writer itself.
        Parameters:
        writer - The writer to which the model is written.
      • linkClassLoader

        public static void linkClassLoader(java.io.ObjectInputStream str,
                           java.lang.ClassLoader loader)
        Associates an input stream with a class loader. If the passed loader happens to be the same as the loader of ObjectInputStream (very unlikely, because ObjectInputStream is a system class and should have no loader), then it is ignored.
      • ioFacilityClass

        public ilog.rules.factory.IlrReflectClass ioFacilityClass()
      • getDynamicClasses

        public java.util.ArrayList getDynamicClasses()

        Gets a list of dynamic classes defined in this reflect. A dynamic class is one which has been defined explicitly, and which is not mapped to a Java class.

        Returns:
        a list of dynamic classes of this reflect.
      • addPackagePath

        public IlrDynamicPackage addPackagePath(java.lang.String pathname)

        Adds a package using a fully-qualified package name. This method breaks the passed package name at the location of the . (dot) character. And for each name composing the package, checks whether the package of that name exists in the enclosing package before proceeding to the creation of the subpackage.

        Parameters:
        pathname - The path name.
        Returns:
        a dynamic package.
      • isInstance

        public boolean isInstance(IlrClass clazz,
                         java.lang.Object object)
        Specified by:
        isInstance in interface ilog.rules.factory.IlrDataAccessStrategy
      • getXOMClass

        public IlrClass getXOMClass(java.lang.Object object)

        Gets the XOM class of an object. If the object is an instance of some class defined in this reflect object, this method will return the instantiation type.

        Specified by:
        getXOMClass in interface ilog.rules.factory.IlrDataAccessStrategy
        Parameters:
        object - An object.
        Returns:
        the object's XOM class.
      • get

        public java.lang.Object get(java.lang.Object object,
                           IlrAttribute attribute)
                             throws java.lang.IllegalArgumentException,
                                    java.lang.IllegalAccessException
        Specified by:
        get in interface ilog.rules.factory.IlrDataAccessStrategy
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • getBoolean

        public boolean getBoolean(java.lang.Object obj,
                         IlrAttribute field)
                           throws java.lang.IllegalArgumentException,
                                  java.lang.IllegalAccessException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • getChar

        public char getChar(java.lang.Object obj,
                   IlrAttribute field)
                     throws java.lang.IllegalArgumentException,
                            java.lang.IllegalAccessException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • getByte

        public byte getByte(java.lang.Object obj,
                   IlrAttribute field)
                     throws java.lang.IllegalArgumentException,
                            java.lang.IllegalAccessException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • getShort

        public short getShort(java.lang.Object obj,
                     IlrAttribute field)
                       throws java.lang.IllegalArgumentException,
                              java.lang.IllegalAccessException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • getInt

        public int getInt(java.lang.Object obj,
                 IlrAttribute field)
                   throws java.lang.IllegalArgumentException,
                          java.lang.IllegalAccessException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • getLong

        public long getLong(java.lang.Object obj,
                   IlrAttribute field)
                     throws java.lang.IllegalArgumentException,
                            java.lang.IllegalAccessException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • getFloat

        public float getFloat(java.lang.Object obj,
                     IlrAttribute field)
                       throws java.lang.IllegalArgumentException,
                              java.lang.IllegalAccessException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • getDouble

        public double getDouble(java.lang.Object obj,
                       IlrAttribute field)
                         throws java.lang.IllegalArgumentException,
                                java.lang.IllegalAccessException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • set

        public void set(java.lang.Object object,
               IlrAttribute attribute,
               java.lang.Object value)
                 throws java.lang.IllegalArgumentException,
                        java.lang.IllegalAccessException
        Specified by:
        set in interface ilog.rules.factory.IlrDataAccessStrategy
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • setBoolean

        public void setBoolean(java.lang.Object obj,
                      IlrAttribute field,
                      boolean value)
                        throws java.lang.IllegalArgumentException,
                               java.lang.IllegalAccessException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • setChar

        public void setChar(java.lang.Object obj,
                   IlrAttribute field,
                   char value)
                     throws java.lang.IllegalArgumentException,
                            java.lang.IllegalAccessException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • setByte

        public void setByte(java.lang.Object obj,
                   IlrAttribute field,
                   byte value)
                     throws java.lang.IllegalArgumentException,
                            java.lang.IllegalAccessException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • setShort

        public void setShort(java.lang.Object obj,
                    IlrAttribute field,
                    short value)
                      throws java.lang.IllegalArgumentException,
                             java.lang.IllegalAccessException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • setInt

        public void setInt(java.lang.Object obj,
                  IlrAttribute field,
                  int value)
                    throws java.lang.IllegalArgumentException,
                           java.lang.IllegalAccessException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • setLong

        public void setLong(java.lang.Object obj,
                   IlrAttribute field,
                   long value)
                     throws java.lang.IllegalArgumentException,
                            java.lang.IllegalAccessException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • setFloat

        public void setFloat(java.lang.Object obj,
                    IlrAttribute field,
                    float value)
                      throws java.lang.IllegalArgumentException,
                             java.lang.IllegalAccessException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • setDouble

        public void setDouble(java.lang.Object obj,
                     IlrAttribute field,
                     double value)
                       throws java.lang.IllegalArgumentException,
                              java.lang.IllegalAccessException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • invoke

        public java.lang.Object invoke(java.lang.Object object,
                              IlrMethod meth,
                              java.lang.Object... arguments)
                                throws java.lang.IllegalArgumentException,
                                       java.lang.IllegalAccessException,
                                       java.lang.reflect.InvocationTargetException
        Specified by:
        invoke in interface ilog.rules.factory.IlrDataAccessStrategy
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
      • newInstance

        public java.lang.Object newInstance(IlrClass c)
                                     throws java.lang.InstantiationException,
                                            java.lang.IllegalAccessException
        Specified by:
        newInstance in interface ilog.rules.factory.IlrDataAccessStrategy
        Throws:
        java.lang.InstantiationException
        java.lang.IllegalAccessException
      • newInstance

        public java.lang.Object newInstance(IlrConstructor cons,
                                   java.lang.Object... args)
                                     throws java.lang.InstantiationException,
                                            java.lang.IllegalAccessException,
                                            java.lang.reflect.InvocationTargetException
        Specified by:
        newInstance in interface ilog.rules.factory.IlrDataAccessStrategy
        Throws:
        java.lang.InstantiationException
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
      • newArrayInstance

        public java.lang.Object newArrayInstance(IlrType componentType,
                                        int length)
                                          throws java.lang.NegativeArraySizeException
        Creates an array of type componentType and of length length.
        Specified by:
        newArrayInstance in interface ilog.rules.factory.IlrDataAccessStrategy
        Since:
        JRules 6.5
        Throws:
        java.lang.NegativeArraySizeException - If the passed length is negative.
        Parameters:
        componentType - The component type.
        length - The array length.
        Returns:
        An array object.
      • newArrayInstance

        public java.lang.Object newArrayInstance(IlrType componentType,
                                        int[] dimensions)
                                          throws java.lang.IllegalArgumentException,
                                                 java.lang.NegativeArraySizeException
        Creates a multi-dimensional array of type componentType.
        Specified by:
        newArrayInstance in interface ilog.rules.factory.IlrDataAccessStrategy
        Since:
        JRules 6.5
        Throws:
        java.lang.NegativeArraySizeException - If the passed length is negative.
        java.lang.IllegalArgumentException
        Parameters:
        componentType - The component type.
        dimensions - The dimensions of the array.
        Returns:
        An array object.

© Copyright IBM Corp. 1987, 2017