Assignment
Package:
com.webobjects.directtoweb
Inherits from:java.lang.Object
Subclasses:
Class Description
This class performs assignments on the right-hand side of rules. Every rule in the rule database has an instance of this class that holds the right-hand-side key and the right-hand-side value. The rule engine uses this class; you should never need to use it.
If you need custom assignment behavior you can subclass Assignment. To do so, you need to provide the two constructors:
Assignment (String keyPath, Object value)
Assignment (EOKeyValueUnarchiver unarchiver)
You can invoke super
for each.
You can then override the fire
method to provide the value. For example, if you define a method myMethod
that returns the right-hand-side value myValue
for a key, the fire
method could look like:
public Object fire(D2WContext context)
{
if (value().equals("myValue")) return myMethod(context);
}
Method Types
Constructors
Static Constants
Assignment Parameters
Firing the Rule
Private Methods
Constructors
Assignment
public Assignment(String keyPath, Object value)
Creates an Assignment object and sets its key path and value.
Assignment
Assignment()
Standard Java no-argument constructor.
Assignment
public Assignment(EOKeyValueUnarchiver unarchiver)
Creates a DefaultAssignment object based on a EOKeyValueUnarchiver object. This constructor is used to read the assignment information from a rule file.
Static Constants
keyPathKey
java.lang.String
This constant is intentionally undocumented.
valueKey
java.lang.String
This constant is intentionally undocumented.
Methods
encodeWithKeyValueArchiver
public Object encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
This method is intentionally undocumented. You should never have to invoke or customize it.
fire
public Object fire(D2WContext context)
This method is invoked when a rule fires. It returns the right-hand-side value (an Object) for a right-hand-side key in the context
Direct to Web context.
You can override this method to provide your own assignments.
keyPath
public String keyPath()
Returns the receiver's right-hand-side key.
toString
public String toString()
Returns a String that represents the assignment. This method is invoked when the D2WTraceRuleFiringEnabled
user default is set to YES
.
value
public Object value(D2WContext context)
Returns the receiver's right-hand-side value.
© 2001 Apple Computer, Inc.