|
WebObjects 5.2.3 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.webobjects.directtoweb.Assignment
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:
MyAssignmentSubclass (String keyPath, Object value) MyAssignmentSubclass (EOKeyValueUnarchiver unarchiver)
You can invoke super for each constructor.
You also need to implement these two methods:
public void encodeWithKeyValueArchiver(EOKeyValueArchiver archiver) {
super.encodeWithKeyValueArchiver(archiver);
}
public static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver) {
return new MyAssignmentSubclass(archiver);
}
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);
}
| Nested Class Summary |
| Nested 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 |
public static final String KeyPathKey
public static final String ValueKey
| Constructor Detail |
public Assignment(String keyPath,
Object value)
keyPath - - the key path.value - - the value.public Assignment(EOKeyValueUnarchiver unarchiver)
unarchiver - - the unarchiver.| Method Detail |
public static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
public void encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
encodeWithKeyValueArchiver in interface EOKeyValueArchivingarchiver - the EOKeyValueArchiverEOKeyValueArchiverpublic Object fire(D2WContext context)
context - - the Direct to Web context.
public String keyPath()
public String toString()
public Object value()
public Object value(D2WContext context)
|
Last updated Thu Oct 21 15:04:16 PDT 2004. | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||