Rule Execution Server API

ilog.rules.util
Class IlrSelector

java.lang.Object
  extended by ilog.rules.util.IlrSelector
Direct Known Subclasses:
IlrObjectModel.SelectorWrapper, IlrSelector.And, IlrSelector.Not, IlrSelector.Or

public class IlrSelector
extends Object

Reflective selector.

To implement a selector, implement a accepts(<the class to accept>) method returning a boolean for each class to be visited. This selector implementation is generic, and thus you can write the accepts method only for the classes you are interested in. Also, it supports inheritance by applying the most specific accepts method that is provided.

If there is no implementation of the accepts method for the current object's class, the accepts(Object) method will be called. By default it returns false.

To use this selector, call the isAccepted method on the object you want to test.


Nested Class Summary
static class IlrSelector.And
          And selector, a selector that accepts an object if both underlying selectors accept it.
static class IlrSelector.Not
          Not selector, a selector that accepts the objects refused by an underlying selector.
static class IlrSelector.Or
          Or selector, a selector that accepts an object if one of the two underlying selectors accepts it.
 
Constructor Summary
IlrSelector()
           
 
Method Summary
 boolean accepts(Object o)
          Default accepts method called whenever there is none more precise.
 boolean areAccepted(Collection collection)
          Method to call to test the acceptance of each element of a collection.
 boolean isAccepted(Object o)
          Tests if an object is acceptable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlrSelector

public IlrSelector()
Method Detail

areAccepted

public boolean areAccepted(Collection collection)
Method to call to test the acceptance of each element of a collection.

Parameters:
collection - A collection. It can be null. In this case, the method returns true.
Returns:
True if the parameter is null, empty or all its objects are accepted.

isAccepted

public boolean isAccepted(Object o)
Tests if an object is acceptable. The best method accepts is called based on the class of the parameter.

Parameters:
o - The object to test. If it is null, this method returns false.
Returns:
True if the object is accepted, or False if the object is null or not accepted.

accepts

public boolean accepts(Object o)
Default accepts method called whenever there is none more precise. It returns false but can be redefined.

Parameters:
o -

Rule Execution Server API

© Copyright IBM Corp. 1987, 2013