Package org.eclipse.ecf.core
Class BaseContainer.Instantiator
- java.lang.Object
-
- org.eclipse.ecf.core.provider.BaseContainerInstantiator
-
- org.eclipse.ecf.core.BaseContainer.Instantiator
-
- All Implemented Interfaces:
IContainerInstantiator
- Enclosing class:
- BaseContainer
public static class BaseContainer.Instantiator extends BaseContainerInstantiator
-
-
Field Summary
Fields Modifier and Type Field Description static String
NAME
-
Fields inherited from class org.eclipse.ecf.core.provider.BaseContainerInstantiator
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, NO_ADAPTERS_ARRAY
-
-
Constructor Summary
Constructors Constructor Description Instantiator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IContainer
createInstance(ContainerTypeDescription description, Object[] parameters)
Create instance of IContainer.String[]
getSupportedAdapterTypes(ContainerTypeDescription description)
Get array of supported adapters for the given container type description.Class[][]
getSupportedParameterTypes(ContainerTypeDescription description)
Get array of parameter types for given container type description.-
Methods inherited from class org.eclipse.ecf.core.provider.BaseContainerInstantiator
getAdaptersForClass, getIDParameterValue, getIDParameterValue, getIDParameterValue, getIntegerFromArg, getInterfacesAndAdaptersForClass, getInterfacesForClass, getInterfacesForClass, getMap, getMapParameterString, getMapParameterString, getParameterValue, getParameterValue, getParameterValue, getParameterValue, getParameterValue, getStringFromArg, getSupportedIntents
-
-
-
-
Field Detail
-
NAME
public static final String NAME
- Since:
- 3.4
- See Also:
- Constant Field Values
-
-
Method Detail
-
createInstance
public IContainer createInstance(ContainerTypeDescription description, Object[] parameters) throws ContainerCreateException
Description copied from interface:IContainerInstantiator
Create instance of IContainer. This is the interface that container provider implementations must implement for the containerFactory extension point. The caller may optionally specify both argument types and arguments that will be passed into this method (and therefore to the provider implementation implementing this method). For example:ContainerFactory.getDefault().createContainer("foocontainer",new Object { "hello" });
- Specified by:
createInstance
in interfaceIContainerInstantiator
- Overrides:
createInstance
in classBaseContainerInstantiator
- Parameters:
description
- the ContainerTypeDescription associated with the registered container provider implementationparameters
- parameters specified by the caller. May be null if no parameters are passed in by caller to ContainerFactory.getDefault().createContainer(...)- Returns:
- IContainer instance. The provider implementation must return a valid object implementing IContainer OR throw a ContainerCreateException. Null will not be returned.
- Throws:
ContainerCreateException
- thrown if instance cannot be created
-
getSupportedAdapterTypes
public String[] getSupportedAdapterTypes(ContainerTypeDescription description)
Description copied from interface:IContainerInstantiator
Get array of supported adapters for the given container type description. Providers implement this method to allow clients to inspect the adapter types exposed by the container described by the given description. The returned array entries will be the fully qualified names of the adapter classes. Note that the returned types do not guarantee that a subsequent call toIContainer.getAdapter(Class)
with the same type name as a returned value will return a non-null
result. In other words, even if the class name is in the returned array, subsequent calls toIContainer.getAdapter(Class)
may still returnnull
.- Specified by:
getSupportedAdapterTypes
in interfaceIContainerInstantiator
- Overrides:
getSupportedAdapterTypes
in classBaseContainerInstantiator
- Parameters:
description
- the ContainerTypeDescription to report adapters for. Must not benull
.- Returns:
- String[] of supported adapters. The entries in the returned array
will be the fully qualified class names of adapters supported by
the given description.
null
may be returned by the provider if no adapters are supported for this description.
-
getSupportedParameterTypes
public Class[][] getSupportedParameterTypes(ContainerTypeDescription description)
Description copied from interface:IContainerInstantiator
Get array of parameter types for given container type description. Providers implement this method to allow clients to inspect the available set of parameter types understood for calls toIContainerInstantiator.createInstance(ContainerTypeDescription, Object[])
.Each of the rows of the returned array specifies a Class[] of parameter types. These parameter types correspond to the types of Object[] that can be passed into the second parameter of
IContainerInstantiator.createInstance(ContainerTypeDescription, Object[])
.Consider the following example:
public Class[][] getSupportedParameterTypes() { return new Class[][] { { String.class }, { String.class, String.class } }; }
The above means that there are two acceptable values for the Object [] passed intoIContainerInstantiator.createInstance(ContainerTypeDescription, Object[])
: 1) a single String, and 2) two Strings. These would therefore be acceptable as input to createInstance:IContainer container = ContainerFactory.getDefault().createContainer( description, new Object[] { "Hello" }); IContainer container2 = ContainerFactory.getDefault().createContainer( description, new Object[] { "Hello" });
- Specified by:
getSupportedParameterTypes
in interfaceIContainerInstantiator
- Overrides:
getSupportedParameterTypes
in classBaseContainerInstantiator
- Parameters:
description
- the ContainerTypeDescription to return parameter types for- Returns:
- Class[][] array of Class[]s. Each row in the table corresponds to
a Class[] that describes the types of Objects in Object[] for
second parameter to
IContainerInstantiator.createInstance(ContainerTypeDescription, Object[])
.null
returned if no parameter types supported for given description.
-
-