Decorating Toy

The Decorating Toy is factory for AOP-style proxies. Any method call is intercepted and can be decorated with an Decorator implementation. In addition to method calls, you may also intercept the return of the call or any thrown exception. See the package description for examples.

Delegating Toy

The Delegating Toy is a factory for proxies, that delegate any call to another object. Depending on the operation mode of the proxy may the target object implement the proxy type or may just have compatible methods. This is a very common pattern and the DelegatingInvoker is a base class for some other proxy toys implementations. See the package description for examples.

Dispatching Toy

The Dispatching Toy is a factory for proxies, dispatch incoming method calls to different object depending their implemented interfaces. Each proxy implements several unrelated interfaces and contains a collection of target objects. Each method call is invoked on one target object from this collection, that implements the interface of the calling method. Although the DispatchingInvoker is not derived from a DelegatingInvoker it utilizes this invoker internally. See the package description for examples.

Echoing Toy

The Echo Toy is a factory for proxies, that implement a classical trace functionality. It implements just an own Decorator (EchoDecorator), that simply writes every method call, the return value and every thrown exception to a PrintWriter. See the package description for examples.

Failover Toy

The Failover Toy is a factory for proxies, that implement a failover strategy. Each proxy has a pool of objects, that will be used one by one after a predefined exception type for the current target object is thrown during a method invocation. The FailoverInvoker is a subclass of the HotSwappingInvoker. See the package description for examples.

Future Toy

The Future Toy is a factory for proxies, that executes any method call asynchronously. The immediate returned object of such a call is itself a HotSwapping proxy stuffed with a Null object until the method returns. The Null proxy is then hot swapped with the returned object. See the package description for examples.

HotSwapping Toy

The Hot Swapping Toy is a factory for proxies, that enable the transparent exchange of the target object for the method invocations. Each created proxy implements the Swappable interface, that is used to do the exchange. Other object that have a reference to a hot swapping proxy, will not notice the internal change of the target object at all. The HotSwappingInvoker is a subclass of the DelegatingInvoker. See the package description for examples.

Multicasting Toy

The Multicasting Toy is a factory for proxies, that will invoke a single method call on every object which they manage in a collection. The different return values are collected and a new multicasting proxy is returned for the result collection. If the result of the invoked method is a primitive type, the proxy will sum up all the results and return this sum as result of the invocation. It does not matter if one of the target object in the collection does not have a method like the one invoked on the proxy, those objects are simply ignored for the routed method invocation. Each multicasting proxy additionally implements the Multicast interface, that permits access to the target object collection of such a proxy. See the package description for examples.

Null Toy

The Null Toy is a factory for proxies, that work as dummy implementations. The proxy will ignore any called methods returning void, will return the native null vale for all primitive types, will return a new Null proxy for all returned objects it can create a new proxy for or simply null. See the package description for examples.

Pool Toy

The Pool Toy is a simple pool implementation based on proxies. Each pool is stuffed with a number of objects that are used as pool resources. Any object returned from the pool is wrapped with a proxy, that implements the Multicast interface, that can be used to return the object to the pool. Additionally any of these objects will return automatically to the pool if their proxy instance is garbage collected. Before an object is added again to the pool after usage, a user-defined Resetter instance may do any reinitializations with such an object or may even decide to discard the object at all. See the package description for examples.

Privileging Toy

The Privileging Toy is a factory for proxies, that execute any call as privileged action by an ActionExecutor in a predefined context. Such a context can be defined by an active SecurityManager that requires an ActionController or a JEE container using different credentials to execute some functionality using a different Subject. See the package description for examples.