net.sf.composite.specialize.specializers
Class BaseSpecializer

java.lang.Object
  extended by net.sf.composite.specialize.specializers.BaseSpecializer
All Implemented Interfaces:
Specializer
Direct Known Subclasses:
CachingSpecializerProxy, CloningSpecializer, Jdk13ProxySpecializer

public abstract class BaseSpecializer
extends java.lang.Object
implements Specializer

A convenient base class for specializers. This base class takes care of exception handling, argument validation and logging.

Since:
Mar 11, 2005
Author:
Matt Sgarlata

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
BaseSpecializer()
           
 
Method Summary
 ComponentAccessor getComponentAccessor()
           
 boolean isSpecializable(java.lang.Object composite, java.lang.Class specializedType)
          Determines whether the components in the composite can be used to create a specialized version of the composite that implements specializedType.
protected abstract  boolean isSpecializableImpl(java.lang.Object composite, java.lang.Class specializedType)
          Implementation template method.
 void setComponentAccessor(ComponentAccessor componentExtractor)
           
 java.lang.Object specialize(java.lang.Object composite, java.lang.Class specializedType)
          Uses the components in the composite to create a composite that implements specializedType and is composed only those
protected abstract  java.lang.Object specializeImpl(java.lang.Object composite, java.lang.Class specializedType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.commons.logging.Log log
Constructor Detail

BaseSpecializer

public BaseSpecializer()
Method Detail

isSpecializableImpl

protected abstract boolean isSpecializableImpl(java.lang.Object composite,
                                               java.lang.Class specializedType)
                                        throws java.lang.Exception
Implementation template method.

Parameters:
composite -
specializedType -
Returns:
boolean
Throws:
java.lang.Exception

isSpecializable

public final boolean isSpecializable(java.lang.Object composite,
                                     java.lang.Class specializedType)
                              throws SpecializationException
Description copied from interface: Specializer
Determines whether the components in the composite can be used to create a specialized version of the composite that implements specializedType.

Specified by:
isSpecializable in interface Specializer
Parameters:
composite - the composite from which the components will be extracted
specializedType - the type to be exposed
Throws:
SpecializationException - if the new, specialized, composite could not be created

specializeImpl

protected abstract java.lang.Object specializeImpl(java.lang.Object composite,
                                                   java.lang.Class specializedType)
                                            throws java.lang.Exception
Throws:
java.lang.Exception

specialize

public final java.lang.Object specialize(java.lang.Object composite,
                                         java.lang.Class specializedType)
                                  throws SpecializationException
Description copied from interface: Specializer
Uses the components in the composite to create a composite that implements specializedType and is composed only those

Specified by:
specialize in interface Specializer
Parameters:
composite - the composite from which the components will be extracted
specializedType - the type to be exposed
Throws:
SpecializationException - if the new, specialized, composite could not be created

getComponentAccessor

public ComponentAccessor getComponentAccessor()

setComponentAccessor

public void setComponentAccessor(ComponentAccessor componentExtractor)


Copyright © 2005-2008.