info.magnolia.i18nsystem.proxytoys
Class FilteringMethodDecorator<T>

java.lang.Object
  extended by com.thoughtworks.proxy.toys.decorate.Decorator<T>
      extended by info.magnolia.i18nsystem.proxytoys.FilteringMethodDecorator<T>
Type Parameters:
T - the decorated type
All Implemented Interfaces:
Serializable

public class FilteringMethodDecorator<T>
extends com.thoughtworks.proxy.toys.decorate.Decorator<T>

A Decorator which delegates to another only for methods accepted by the given Predicate. TODO: methodSelector is called 4 times, but I couldn't find a way to hook this into ProxyToys without rewriting more code.

See Also:
Serialized Form

Constructor Summary
FilteringMethodDecorator(com.thoughtworks.proxy.toys.decorate.Decorator<T> delegate, com.google.common.base.Predicate<Method> methodSelector)
           
 
Method Summary
 Object[] beforeMethodStarts(T proxy, Method method, Object[] args)
           
 Exception decorateInvocationException(T proxy, Method method, Object[] args, Exception cause)
           
 Object decorateResult(T proxy, Method method, Object[] args, Object result)
           
 Throwable decorateTargetException(T proxy, Method method, Object[] args, Throwable cause)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilteringMethodDecorator

public FilteringMethodDecorator(com.thoughtworks.proxy.toys.decorate.Decorator<T> delegate,
                                com.google.common.base.Predicate<Method> methodSelector)
Method Detail

beforeMethodStarts

public Object[] beforeMethodStarts(T proxy,
                                   Method method,
                                   Object[] args)
Overrides:
beforeMethodStarts in class com.thoughtworks.proxy.toys.decorate.Decorator<T>

decorateResult

public Object decorateResult(T proxy,
                             Method method,
                             Object[] args,
                             Object result)
Overrides:
decorateResult in class com.thoughtworks.proxy.toys.decorate.Decorator<T>

decorateTargetException

public Throwable decorateTargetException(T proxy,
                                         Method method,
                                         Object[] args,
                                         Throwable cause)
Overrides:
decorateTargetException in class com.thoughtworks.proxy.toys.decorate.Decorator<T>

decorateInvocationException

public Exception decorateInvocationException(T proxy,
                                             Method method,
                                             Object[] args,
                                             Exception cause)
Overrides:
decorateInvocationException in class com.thoughtworks.proxy.toys.decorate.Decorator<T>


Copyright © 2003-2014 Magnolia International Ltd.. All Rights Reserved.