|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ChainBuilder
Service interface for hivemind.lib.ChainBuilder
, a service which can assemble an
implementation based on a command interface, and an ordered list of objects implementing that
interface (the "commands"). This is an implementation of the Gang of Four Chain Of Command
pattern.
For each method in the interface, the chain implementation will call the corresponding method on each command object in turn. If any of the command objects return true, then the chain of command stops and the initial method invocation returns true. Otherwise, the chain of command continues to the next command (and will return false if none of the commands returns true).
For methods whose return type is not boolean, the chain stops with the first non-null (for object types), or non-zero (for numeric types). The chain returns the value that was returned by the command. The chain If the method return type is void, all command will be invoked.
Method invocations will also be terminated if an exception is thrown.
Method Summary | |
---|---|
java.lang.Object |
buildImplementation(java.lang.Class commandInterface,
java.util.List commands,
java.lang.String toString)
Builds an implementation. |
Method Detail |
---|
java.lang.Object buildImplementation(java.lang.Class commandInterface, java.util.List commands, java.lang.String toString)
commandInterface
- the interface the implementation implements.commands
- a non-null list of command objects implementing the interface.toString
- The value to be returned from the implementation's toString()
method (unless toString()
is expressly part of the service
interface, in which case it is treated as any other method.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |