org.eclipse.jst.jsf.context.internal.provisional
Interface IDelegatingFactory

All Known Implementing Classes:
AbstractDelegatingFactory

public interface IDelegatingFactory

Defines a type of factory that can have delegate factories to help it create an appropriate instance type. The general contract for implementors is: 1) You must follow the isValidDelegate contract. 2) You should try to create an instance yourself and only delegate if cannot do it yourself. Deviations from this rule must be clearly documented to ensure clients understand how the factory works. Clients may implement this interface


Method Summary
 void addFactoryDelegate(org.eclipse.core.runtime.IAdaptable delegate)
          Adds delgate to the end of the list of factory delegates if the list does not already contain it.
 java.util.List getValidDelegateTypes()
           
 boolean isValidDelegate(org.eclipse.core.runtime.IAdaptable delegate)
          The return value of this method should conform to the following contract: Let v = getValidDelegates.
 boolean removeFactoryDelegate(org.eclipse.core.runtime.IAdaptable delegate)
           
 

Method Detail

addFactoryDelegate

public void addFactoryDelegate(org.eclipse.core.runtime.IAdaptable delegate)
Adds delgate to the end of the list of factory delegates if the list does not already contain it.

Parameters:
delegate -
Throws:
java.lang.ClassCastException - if delegate does not implement an expected interface. Each implementor can define what delegates are valid based on the isValidDelegate() and getValidDelegates contracts

removeFactoryDelegate

public boolean removeFactoryDelegate(org.eclipse.core.runtime.IAdaptable delegate)
Parameters:
delegate -
Returns:
true if delegate was removed, false if delegate wasn't in the list of delegates

getValidDelegateTypes

public java.util.List getValidDelegateTypes()
Returns:
a list of Class objects that represent the interfaces that may be passed to addFactoryDelegate. Implementor should return at least one supported class.

isValidDelegate

public boolean isValidDelegate(org.eclipse.core.runtime.IAdaptable delegate)
The return value of this method should conform to the following contract: Let v = getValidDelegates. Then isValidDelegate should return true only if the set of v contains a Class for which delegate.getAdapter(Class) returns a non-null value.

Parameters:
delegate -
Returns:
true if delegate is supported, false otherwise.