Rule Execution Server API

ilog.rules.factory
Interface IlrClassFinder


public interface IlrClassFinder

A class finder is used to find the classes by names during the rule parsing time. An instance of this class holds 2 lists: a list of IlrReflectClass objects, and a list of Strings. The first list represents the classes which are imported explicitly using their fully-qualified names, while the second list represents the imported packages. An implementation of this class should register the imported classes and packages, and must then respond to requests issued from the parser for finding classes using names: simple names or fully-qualified names. Of course, the searching algorithm may use cache to speed up the class finding. Moreover, an implementation of this class should be MT-safe.


Method Summary
 void addImportedClass(ilog.rules.factory.IlrReflectClass importedClass)
          This method is called by the parser for registering an imported class.
 void addImportedPackage(String packageName)
          This method is called by the parser for registering an imported package.
 ilog.rules.factory.IlrReflectClass findUsingBaseName(String name, ilog.rules.factory.IlrReflectClass[] other)
          Finds a class using a name.
 ilog.rules.factory.IlrReflectClass findUsingBaseName(String name, ilog.rules.factory.IlrReflectClass[] other, IlrType[] typeParameters)
          Finds an instance of a generic definition using a name and type parameters.
 ilog.rules.factory.IlrReflectClass findUsingFullName(String name)
          Finds a class using a fully-qualified name.
 ilog.rules.factory.IlrReflectClass findUsingFullName(String name, IlrType[] typeParameters)
          Finds an instance of a generic definition using a fully-qualified name and type parameters.
 boolean matchPackage(String className)
          Checks whether for the passed class name matches one of the imported packages.
 void removeImportedClass(ilog.rules.factory.IlrReflectClass importedClass)
          This method is called to remove an imported class.
 void reset()
          Resets this object to the initial state.
 

Method Detail

reset

void reset()
Resets this object to the initial state. In particular, this method will remove any cache used to speed up the class finding. The implicitly imported packages, "java.lang" and "ilog.rules.engine", should remain among the list of imported packages after this method has been called.


addImportedPackage

void addImportedPackage(String packageName)
This method is called by the parser for registering an imported package. During the parsing of rule files, whenever the parser sees "import xx.yy.zz.*;" directives, this method will be called with "xx.yy.zz" as argument. Note that the parser may call this method several times for a same package, so it is necessary to check whether the passed package is already in the package list.


matchPackage

boolean matchPackage(String className)
Checks whether for the passed class name matches one of the imported packages. The class name matches an imported package string iff the class name starts with the package name, and that the character immediately after is ".".


addImportedClass

void addImportedClass(ilog.rules.factory.IlrReflectClass importedClass)
This method is called by the parser for registering an imported class. During the parsing of rule files, whenever the parser sees "import xx.yy.zz.MyClass;", and provided that the specified class has been found, then this method is called with the found class as argument.


removeImportedClass

void removeImportedClass(ilog.rules.factory.IlrReflectClass importedClass)
This method is called to remove an imported class. This method is not called by the rule parser, it is only called through the IlrRuleset API to remove a particular class. By contract, after this method is called, the object should not maintain any references to the specified class.


findUsingFullName

ilog.rules.factory.IlrReflectClass findUsingFullName(String name)
Finds a class using a fully-qualified name. This method does an exact search on a class. If this method returns a non-null object, then that object must satisfy: <returned object>.getFullyQualifiedName().equals(name).


findUsingFullName

ilog.rules.factory.IlrReflectClass findUsingFullName(String name,
                                                     IlrType[] typeParameters)
Finds an instance of a generic definition using a fully-qualified name and type parameters. This method does an exact search on a class. If this method returns a non-null object, then that object must satisfy: <returned object>.getFullyQualifiedName().equals(name).


findUsingBaseName

ilog.rules.factory.IlrReflectClass findUsingBaseName(String name,
                                                     ilog.rules.factory.IlrReflectClass[] other)
Finds a class using a name. This is a general class searching method, and the name could be a simple name or a fully-qualified name.


findUsingBaseName

ilog.rules.factory.IlrReflectClass findUsingBaseName(String name,
                                                     ilog.rules.factory.IlrReflectClass[] other,
                                                     IlrType[] typeParameters)
Finds an instance of a generic definition using a name and type parameters. The name could be a simple name or a fully-qualified name.


Rule Execution Server API

© Copyright IBM Corp. 1987, 2013