org.ops4j.peaberry.util
Class AbstractDecorator<S>

java.lang.Object
  extended by org.ops4j.peaberry.util.AbstractDecorator<S>
All Implemented Interfaces:
ImportDecorator<S>

public abstract class AbstractDecorator<S>
extends Object
implements ImportDecorator<S>

Skeletal implementation to simplify development of ImportDecorators.

Developers only have to extend this class and provide an implementation of the decorate(Object, Map) method, which takes the original service instance and associated attribute map, and returns a decorated instance.

Author:
mcculls@gmail.com (Stuart McCulloch)

Constructor Summary
AbstractDecorator()
           
 
Method Summary
<T extends S>
Import<T>
decorate(Import<T> service)
          Decorate the given imported service.
protected abstract  S decorate(S instance, Map<String,?> attributes)
          Decorate the current service instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDecorator

public AbstractDecorator()
Method Detail

decorate

public final <T extends S> Import<T> decorate(Import<T> service)
Description copied from interface: ImportDecorator
Decorate the given imported service.

Specified by:
decorate in interface ImportDecorator<S>
Parameters:
service - imported service handle
Returns:
decorated service handle

decorate

protected abstract S decorate(S instance,
                              Map<String,?> attributes)
Decorate the current service instance.

Parameters:
instance - service instance
attributes - service attributes
Returns:
decorated service instance


Copyright © 2006-2012 OPS4J - Open Participation Software for Java. All Rights Reserved.