net.sf.composite.specialize.specializers
Class CloningSpecializer

java.lang.Object
  extended by net.sf.composite.specialize.specializers.BaseSpecializer
      extended by net.sf.composite.specialize.specializers.CloningSpecializer
All Implemented Interfaces:
Specializer

public class CloningSpecializer
extends BaseSpecializer

Specializes a composite by cloning it and then filtering out components that are not of the requested specializedType. Since this specializer relies on cloning, the original composite must implement the requested specializedType.

The main benefit of this specializer is performance. The main drawback is that the composite to be specialized must implement all of the interfaces to which it may be specialized.

Since:
Feb 2, 2006
Author:
Matt Sgarlata

Field Summary
 
Fields inherited from class net.sf.composite.specialize.specializers.BaseSpecializer
log
 
Constructor Summary
CloningSpecializer()
           
 
Method Summary
protected  boolean isSpecializableImpl(java.lang.Object composite, java.lang.Class specializedType)
          Implementation template method.
protected  java.lang.Object specializeImpl(java.lang.Object composite, java.lang.Class specializedType)
           
 
Methods inherited from class net.sf.composite.specialize.specializers.BaseSpecializer
getComponentAccessor, isSpecializable, setComponentAccessor, specialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CloningSpecializer

public CloningSpecializer()
Method Detail

isSpecializableImpl

protected boolean isSpecializableImpl(java.lang.Object composite,
                                      java.lang.Class specializedType)
                               throws java.lang.Exception
Description copied from class: BaseSpecializer
Implementation template method.

Specified by:
isSpecializableImpl in class BaseSpecializer
Returns:
boolean
Throws:
java.lang.Exception

specializeImpl

protected java.lang.Object specializeImpl(java.lang.Object composite,
                                          java.lang.Class specializedType)
                                   throws java.lang.Exception
Specified by:
specializeImpl in class BaseSpecializer
Throws:
java.lang.Exception


Copyright © 2005-2008.