org.cruxframework.crux.core.config
Class ConstantsInvocationHandler

java.lang.Object
  extended by org.cruxframework.crux.core.config.ConstantsInvocationHandler
All Implemented Interfaces:
InvocationHandler
Direct Known Subclasses:
ConfigurationInvocationHandler

public abstract class ConstantsInvocationHandler
extends Object
implements InvocationHandler

Dynamic proxy for message resources.

Author:
Thiago da Rosa de Bustamante, Gesse S. F. Dafe

Constructor Summary
ConstantsInvocationHandler(Class<?> targetInterface)
           
ConstantsInvocationHandler(Class<?> targetInterface, boolean isCacheable)
           
 
Method Summary
protected  String getMessageFromAnnotation(Method method, Object[] args, String name)
           
protected  String getMessageFromProperties(Object[] args, String name)
           
protected abstract
<T> PropertyResourceBundle
getPropertiesForLocale(Class<T> targetInterface)
           
 Object invoke(Object proxy, Method method, Object[] args)
           
protected  void invokeSetter(Method method, Object[] args)
           
protected  boolean isValidPropertySetter(Method method)
           
protected static PropertyResourceBundle loadProperties(Class<?> targetInterface, Locale locale)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstantsInvocationHandler

public ConstantsInvocationHandler(Class<?> targetInterface,
                                  boolean isCacheable)
Parameters:
targetInterface -

ConstantsInvocationHandler

public ConstantsInvocationHandler(Class<?> targetInterface)
Parameters:
targetInterface -
Method Detail

invoke

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

getMessageFromProperties

protected String getMessageFromProperties(Object[] args,
                                          String name)
Parameters:
args -
name -
Returns:

getMessageFromAnnotation

protected String getMessageFromAnnotation(Method method,
                                          Object[] args,
                                          String name)
Parameters:
method -
args -
name -
Returns:

isValidPropertySetter

protected boolean isValidPropertySetter(Method method)
Parameters:
method -
Returns:

invokeSetter

protected void invokeSetter(Method method,
                            Object[] args)
Parameters:
properties -
method -
args -

loadProperties

protected static PropertyResourceBundle loadProperties(Class<?> targetInterface,
                                                       Locale locale)
Parameters:
targetInterface -
locale -
Returns:

getPropertiesForLocale

protected abstract <T> PropertyResourceBundle getPropertiesForLocale(Class<T> targetInterface)
Type Parameters:
T -
Parameters:
targetInterface -
Returns:


Copyright © 2014. All rights reserved.