|
|
Tuples, Collectors and Agents for Java
- type-safe replacement for
- reflective invocation of methods/constructors
- callback closure objects
- grouping objects
- parameters
- returned values
- based on Eiffel
- beyond Eiffel
- Collectors are reusable abstraction of Agents
- benefiting from Java 5 generics
- immutable objects
- shared across Threads
- used many times
Tuple
- ordered list
- heterogenous - entries of various types
- type-safe access to each entry
- fixed size
Collector
- expects and collects entries
- fixed number
- ordered
- various types
- binds 'extra' entries
- various number
- ordered
- flexible type-safe
- operations
- some entries may be skipped
- return a Collector for the unfilled rest of the entries
- once all is collected
- it 'settles'
- processes the entries
- returns a result of 'settling'
- after 'settling', a customized handler can be invoked
- the entries are available to the handler
Agent
- special case of Collector
- binds to a method/constructor
- validates parameter and return types, and optional instance type
- binds to an instance - for non-static methods
- 'settling' returns an AgentMethod object
- use AgentMethod to invoke the method/constructor
Download
and try it yourself. See the example application net.sf.reuse.eiffel.TestAgents for more.
|