net.sf.composite
Interface SpecializableComposite

All Superinterfaces:
Composite
All Known Implementing Classes:
CompositeDecorator

public interface SpecializableComposite
extends Composite

A composite that may be exposable as types in addition to those explicitly specified in the class declaration. For example, if some subset of the components of a composite all implement some interface that is not implemented by the composite itself, a new composite can be created that implements this interface that all the components implement. All that is needed is a method of choosing which component should perform the requested operation. This method of choosing is not specified by this interface; rather, this interface simply indicates that this composite may expose additional interfaces if those interfaces are implemented by some subset of the components of this composite.

Since:
Dec 27, 2004
Author:
Matt Sgarlata

Method Summary
 boolean isSpecializable(java.lang.Class type)
          Indicates whether this composite can expose the given interface by dynamically creating a new composite.
 java.lang.Object specialize(java.lang.Class type)
          Uses the components in this composite to dynamically create a composite that implements type.
 

Method Detail

specialize

java.lang.Object specialize(java.lang.Class type)
                            throws SpecializationException
Uses the components in this composite to dynamically create a composite that implements type.

Parameters:
type - the interface to be exposed
Returns:
the new composite that implements the requested interface
Throws:
SpecializationException - if an error occurs while creating the new, specialized, composite that implements the requested interface

isSpecializable

boolean isSpecializable(java.lang.Class type)
                        throws SpecializationException
Indicates whether this composite can expose the given interface by dynamically creating a new composite.

Parameters:
type - the interface to be exposed
Returns:
whether this composite can expose the given interface by dynamically creating a new composite
Throws:
SpecializationException - if an error occurrs


Copyright © 2005-2008.