WebObjects 5.2

com.webobjects.directtoweb
Class Assignment

java.lang.Object
  |
  +--com.webobjects.directtoweb.Assignment
All Implemented Interfaces:
EOKeyValueArchiving, Serializable
Direct Known Subclasses:
BooleanAssignment, DefaultAssignment, EntityAssignment, TabDictionaryComputer

public class Assignment
extends Object
implements EOKeyValueArchiving, Serializable

The Assignment 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);
 }
 

See Also:
Serialized Form

Inner classes inherited from class com.webobjects.eocontrol.EOKeyValueArchiving
EOKeyValueArchiving.Awaking, EOKeyValueArchiving.FinishInitialization, EOKeyValueArchiving.Support
 
Field Summary
static String KeyPathKey
          This constant is intentionally undocumented.
static String ValueKey
          This constant is intentionally undocumented.
 
Constructor Summary
Assignment(EOKeyValueUnarchiver unarchiver)
          Constructs a new Assignment based on an EOKeyValueUnarchiver.
Assignment(String keyPath, Object value)
          Constructs a new Assignment with the specified key path and value.
 
Method Summary
static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
          This method is intentionally undocumented.
 void encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
          This method is intentionally undocumented.
 Object fire(D2WContext context)
          This method is invoked when a rule fires.
 String keyPath()
          Gets the receiver's right-hand-side key.
 String toString()
          Returns a string representation of this Assignment object rendered as the key path, equals sign, and the value.
 Object value()
          Gets the receiver's right-hand-side value.
 Object value(D2WContext context)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KeyPathKey

public static final String KeyPathKey
This constant is intentionally undocumented.

ValueKey

public static final String ValueKey
This constant is intentionally undocumented.
Constructor Detail

Assignment

public Assignment(String keyPath,
                  Object value)
Constructs a new Assignment with the specified key path and value.
Parameters:
keyPath - - the key path.
value - - the value.

Assignment

public Assignment(EOKeyValueUnarchiver unarchiver)
Constructs a new Assignment based on an EOKeyValueUnarchiver. This is used to read the assignment information from a rule file.
Parameters:
unarchiver - - the unarchiver.
Method Detail

decodeWithKeyValueUnarchiver

public static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
This method is intentionally undocumented. You should never have to invoke or customize it.

encodeWithKeyValueArchiver

public void encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
This method is intentionally undocumented. You should never have to invoke or customize it.
Specified by:
encodeWithKeyValueArchiver in interface EOKeyValueArchiving
Following copied from interface: com.webobjects.eocontrol.EOKeyValueArchiving
Parameters:
archiver - the EOKeyValueArchiver
See Also:
EOKeyValueArchiver

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 Direct to Web context. You can override this method to provide your own assignments.
Parameters:
context - - the Direct to Web context.
Returns:
the value.

keyPath

public String keyPath()
Gets the receiver's right-hand-side key.
Returns:
the key path.

toString

public String toString()
Returns a string representation of this Assignment object rendered as the key path, equals sign, and the value.
Overrides:
toString in class Object
Returns:
a string representation of this Assignment.

value

public Object value()
Gets the receiver's right-hand-side value.
Returns:
the value.

value

public Object value(D2WContext context)
Deprecated.  

Gets the receiver's right-hand-side value.
Returns:
the value.

Last updated Fri Feb 21 13:15:00 PST 2003.

Copyright © 2003 Apple Computer, Inc.