net.sf.composite.composites
Class CompositeDecorator

java.lang.Object
  extended by net.sf.composite.composites.BaseComposite
      extended by net.sf.composite.composites.CompositeDecorator
All Implemented Interfaces:
Composite, ListableComposite, SimpleComposite, SpecializableComposite, StrictlyTypedComposite, ValidatableComposite

public class CompositeDecorator
extends BaseComposite
implements SpecializableComposite

Wraps a SimpleComposite so that it implements the ListableComposite and SpecializableComposite interfaces.

Since:
Dec 27, 2004
Author:
Matt Sgarlata

Constructor Summary
CompositeDecorator()
          Creates a new composite decorator.
CompositeDecorator(SimpleComposite composite)
          Creates a new composite that decorates the given composite.
 
Method Summary
 java.lang.Object[] getComponents()
          Retrieves the components of the underlying composite.
 SimpleComposite getComposite()
           
 boolean isSpecializable(java.lang.Class type)
          Indicates whether this composite can expose the given interface by dynamically creating a new composite.
 void setComponents(java.lang.Object[] components)
          Sets the components of the underlying compmosite
 void setComposite(SimpleComposite composite)
           
 java.lang.Object specialize(java.lang.Class type)
          Uses the components in this composite to dynamically create a composite that implements type.
 
Methods inherited from class net.sf.composite.composites.BaseComposite
containsComponentOfType, getComponentsOfType, getComponentType, getComponentValidator, getSpecializer, initializeImpl, setComponent, setComponentValidator, setSpecializer, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeDecorator

public CompositeDecorator()
Creates a new composite decorator. To complete initialization of the decorator, the setComposite(SimpleComposite)method must be called


CompositeDecorator

public CompositeDecorator(SimpleComposite composite)
Creates a new composite that decorates the given composite.

Parameters:
composite - the composite to be decorated.
Method Detail

isSpecializable

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

Specified by:
isSpecializable in interface SpecializableComposite
Overrides:
isSpecializable in class BaseComposite
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

specialize

public java.lang.Object specialize(java.lang.Class type)
                            throws SpecializationException
Description copied from interface: SpecializableComposite
Uses the components in this composite to dynamically create a composite that implements type.

Specified by:
specialize in interface SpecializableComposite
Overrides:
specialize in class BaseComposite
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

getComposite

public SimpleComposite getComposite()

setComposite

public void setComposite(SimpleComposite composite)

getComponents

public java.lang.Object[] getComponents()
Retrieves the components of the underlying composite.

Specified by:
getComponents in interface SimpleComposite
Overrides:
getComponents in class BaseComposite
Returns:
the components of the underlying composite

setComponents

public void setComponents(java.lang.Object[] components)
Sets the components of the underlying compmosite

Specified by:
setComponents in interface SimpleComposite
Overrides:
setComponents in class BaseComposite
Parameters:
components - the new components that will make up the underlying composite


Copyright © 2005-2008.