org.ow2.orchestra.util
Class Chainer<T>

java.lang.Object
  extended by org.ow2.orchestra.util.Chainer<T>
All Implemented Interfaces:
InvocationHandler

public class Chainer<T>
extends Object
implements InvocationHandler

Generic chainer. This InvocationHandler allows chaining of void only method invocations. If an exception is raised during the invocation of a void method in the chain, then the forwarding is stopped, and the exception will be raised up. Note that if a non-void method is invoked, an IllegalArgumentException is thrown.

Author:
Pierre Vigneras

Constructor Summary
Chainer()
           
 
Method Summary
 void add(int i, T element)
           
 void add(T element)
           
 boolean contains(T element)
           
 T get(int i)
           
 List<T> getAsList()
           
 Object invoke(Object proxy, Method method, Object[] args)
           
 T remove(int i)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Chainer

public Chainer()
Method Detail

add

public void add(T element)

add

public void add(int i,
                T element)

remove

public T remove(int i)

get

public T get(int i)

contains

public boolean contains(T element)

getAsList

public List<T> getAsList()

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Specified by:
invoke in interface InvocationHandler
Throws:
Throwable


Copyright © 2011 OW2 Consortium. All Rights Reserved.