biz.hammurapi.convert
Class DecoratingService

java.lang.Object
  extended by biz.hammurapi.convert.DecoratingService

public class DecoratingService
extends java.lang.Object

Decorates objects based on their type and decoration providers available. Decoration is done with dynamic proxies.

Author:
Pavel

Field Summary
static Decorator DECORATOR
          Converter which delegates to convert() method.
 
Constructor Summary
DecoratingService()
           
 
Method Summary
static java.lang.Object decorate(java.lang.Object obj)
          Decorates object using static decoration providers from the object's class classloader.
static java.lang.Object decorate(java.lang.Object obj, java.lang.ClassLoader classLoader)
          Decorates object using providers from the given classloader.
static java.lang.Object decorate(java.lang.Object obj, Context context)
          Decorates object using static decoration providers from the object's class classloader.
static java.lang.Object decorate(java.lang.Object obj, Context context, java.lang.ClassLoader classLoader)
          Decorates object using given context for dynamic decorators and given class loader to load decorating providers.
static Decorator getDecorator()
          Creates decorating closure.
static Decorator getDecorator(java.lang.ClassLoader classLoader)
          Creates decorating closure.
static Decorator getDecorator(Context context)
          Creates decorating closure.
static Decorator getDecorator(Context context, java.lang.ClassLoader classLoader)
          Creates decorating closure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DECORATOR

public static final Decorator DECORATOR
Converter which delegates to convert() method.

Constructor Detail

DecoratingService

public DecoratingService()
Method Detail

decorate

public static java.lang.Object decorate(java.lang.Object obj)
Decorates object using static decoration providers from the object's class classloader. If there are no decorations available or object doesn't impement any interfaces, then the object is returned as-is.

Parameters:
obj - Object to be decorated
Returns:
Decorated object (dynamic proxy instance) or original object if no decorations are available or object doesn't implement any interfaces.

decorate

public static java.lang.Object decorate(java.lang.Object obj,
                                        Context context)
Decorates object using static decoration providers from the object's class classloader. If there are no decorations available or object doesn't impement any interfaces, then the object is returned as-is.

Parameters:
obj - Object to be decorated
context - Context for dynamic decorators.
Returns:
Decorated object (dynamic proxy instance) or original object if no decorations are available or object doesn't implement any interfaces.

decorate

public static java.lang.Object decorate(java.lang.Object obj,
                                        java.lang.ClassLoader classLoader)
Decorates object using providers from the given classloader.

Parameters:
obj - Object to decorate.
classLoader - Class loader.
Returns:
Decorated object (dynamic proxy instance) or original object if no decorations are available or object doesn't implement any interfaces.

decorate

public static java.lang.Object decorate(java.lang.Object obj,
                                        Context context,
                                        java.lang.ClassLoader classLoader)
Decorates object using given context for dynamic decorators and given class loader to load decorating providers.

Parameters:
obj - Object to decorate.
context - Context for dynamic decorators.
classLoader - Class loader.
Returns:
Decorated object (dynamic proxy instance) or original object if no decorations are available or object doesn't implement any interfaces.

getDecorator

public static Decorator getDecorator()
Creates decorating closure.

Returns:
Decorating closure.

getDecorator

public static Decorator getDecorator(java.lang.ClassLoader classLoader)
Creates decorating closure.

Parameters:
classLoader - Class loader.
Returns:
Decorating closure.

getDecorator

public static Decorator getDecorator(Context context)
Creates decorating closure.

Parameters:
context - Context for dynamic decorators.
Returns:
Decorating closure.

getDecorator

public static Decorator getDecorator(Context context,
                                     java.lang.ClassLoader classLoader)
Creates decorating closure.

Parameters:
context - Context for dynamic decorators.
classLoader - Class loader.
Returns:
Decorating closure.


Copyright © 2003 Hammurapi Group. All Rights Reserved.