jaxx.runtime.decorator
Class DecoratorProvider

java.lang.Object
  extended by jaxx.runtime.decorator.DecoratorProvider

public abstract class DecoratorProvider
extends Object

A decorator provider.

Implements the method loadDecorators() to fill the decorators availables.

Then can obtain decorator via the methods getDecorator(...)

Since:
1.7
Author:
tchemit

Nested Class Summary
static class DecoratorProvider.DecoratorContext<T>
           
 
Field Summary
protected  List<DecoratorProvider.DecoratorContext<?>> decorators
          Registred decorators.
 
Constructor Summary
DecoratorProvider()
           
 
Method Summary
 void clear()
           
<O> Decorator<O>
getDecorator(Class<O> type)
          Obtain a decorator given a type.
<O> Decorator<O>
getDecorator(Class<O> type, String name)
          Obtain a decorator given a type and a extra name.
<O> Decorator<O>
getDecorator(O object)
          Obtain a decorator for the given object.
<O> Decorator<O>
getDecorator(O object, String name)
          Obtain a decorator given a object and an extra name to qualify the context.
protected
<T> DecoratorProvider.DecoratorContext<T>
getDecoratorContext(Class<T> type, String context)
           
protected  List<DecoratorProvider.DecoratorContext<?>> getDecorators()
           
protected abstract  void loadDecorators()
          Load all decorators of the provider
protected  void registerDecorator(Decorator<?> decorator)
           
protected
<T> void
registerDecorator(String context, Decorator<T> decorator)
          Register a new decorator in the cache of the provider.
protected  void registerJXPathDecorator(Class<?> klass, String expression)
           
protected  void registerJXPathDecorator(Class<?> klass, String name, String expression)
           
protected  void registerMultiJXPathDecorator(Class<?> klass, String expression, String separator, String separatorReplacement)
           
protected  void registerMultiJXPathDecorator(Class<?> klass, String name, String expression, String separator, String separatorReplacement)
           
protected  void registerPropertyDecorator(Class<?> klass, String expression)
           
protected  void registerPropertyDecorator(Class<?> klass, String name, String expression)
           
 void reload()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

decorators

protected List<DecoratorProvider.DecoratorContext<?>> decorators
Registred decorators.

Constructor Detail

DecoratorProvider

public DecoratorProvider()
Method Detail

loadDecorators

protected abstract void loadDecorators()
Load all decorators of the provider


getDecorator

public <O> Decorator<O> getDecorator(O object)
Obtain a decorator for the given object.

Type Parameters:
O - object of decorated object
Parameters:
object - object of decorated object
Returns:
the decorator or null if not found

getDecorator

public <O> Decorator<O> getDecorator(O object,
                                     String name)
Obtain a decorator given a object and an extra name to qualify the context.

Type Parameters:
O - object of decorated object
Parameters:
object - object of decorated object
name - extra name to qualify the decorator to use
Returns:
the decorator or null if not found

getDecorator

public <O> Decorator<O> getDecorator(Class<O> type)
Obtain a decorator given a type.

Type Parameters:
O - type of decorated object
Parameters:
type - type of decorated object
Returns:
the decorator or null if not found

getDecorator

public <O> Decorator<O> getDecorator(Class<O> type,
                                     String name)
Obtain a decorator given a type and a extra name.

Type Parameters:
O - type of decorated object
Parameters:
type - type of decorated object
name - extra name to qualify the decorator to use
Returns:
the decorator or null if not found

reload

public void reload()

clear

public void clear()

registerPropertyDecorator

protected void registerPropertyDecorator(Class<?> klass,
                                         String expression)

registerJXPathDecorator

protected void registerJXPathDecorator(Class<?> klass,
                                       String expression)

registerMultiJXPathDecorator

protected void registerMultiJXPathDecorator(Class<?> klass,
                                            String expression,
                                            String separator,
                                            String separatorReplacement)

registerPropertyDecorator

protected void registerPropertyDecorator(Class<?> klass,
                                         String name,
                                         String expression)

registerJXPathDecorator

protected void registerJXPathDecorator(Class<?> klass,
                                       String name,
                                       String expression)

registerMultiJXPathDecorator

protected void registerMultiJXPathDecorator(Class<?> klass,
                                            String name,
                                            String expression,
                                            String separator,
                                            String separatorReplacement)

registerDecorator

protected void registerDecorator(Decorator<?> decorator)

registerDecorator

protected <T> void registerDecorator(String context,
                                     Decorator<T> decorator)
Register a new decorator in the cache of the provider.

Type Parameters:
T - type of data decorated
Parameters:
context - the name decorator
decorator - the decorator to register

getDecorators

protected List<DecoratorProvider.DecoratorContext<?>> getDecorators()

getDecoratorContext

protected <T> DecoratorProvider.DecoratorContext<T> getDecoratorContext(Class<T> type,
                                                                        String context)


Copyright © 2008-2010 CodeLutin. All Rights Reserved.