Package org.eclipse.ecf.core.sharedobject

## Class SharedObjectFactory

- java.lang.Object
- - org.eclipse.ecf.core.sharedobject.SharedObjectFactory

All Implemented Interfaces:
  `ISharedObjectFactory`

    public class SharedObjectFactory
    extends Object
    implements ISharedObjectFactory

Factory for creating `ISharedObject` instances. This class provides ECF clients an entry point to constructing `ISharedObject` instances.

### Field Summary

Fields
`protected static ISharedObjectFactory` `instance`

### Constructor Summary

Constructors
`protected` `SharedObjectFactory()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`SharedObjectTypeDescription` `addDescription​(SharedObjectTypeDescription description)`
`protected SharedObjectTypeDescription` `addDescription0​(SharedObjectTypeDescription n)`
`boolean` `containsDescription​(SharedObjectTypeDescription scd)` Check to see if a given named description is already contained by this factory
`protected boolean` `containsDescription0​(SharedObjectTypeDescription scd)`
`ISharedObject` `createSharedObject​(String descriptionName)` Create ISharedObject instance.
`ISharedObject` `createSharedObject​(String descriptionName, Object[] args)` Create ISharedObject instance.
`ISharedObject` `createSharedObject​(SharedObjectTypeDescription desc, Object[] args)` Create ISharedObject instance.
`static ISharedObjectFactory` `getDefault()`
`protected SharedObjectTypeDescription` `getDescription0​(String name)`
`protected SharedObjectTypeDescription` `getDescription0​(SharedObjectTypeDescription scd)`
`SharedObjectTypeDescription` `getDescriptionByName​(String name)` Get the known SharedObjectTypeDescription given it's name.
`List` `getDescriptions()` Get a collection of the SharedObjectTypeDescriptions currently known to this factory.
`protected List` `getDescriptions0()`
`SharedObjectTypeDescription` `removeDescription​(SharedObjectTypeDescription scd)` Remove given description from set known to this factory.
`protected SharedObjectTypeDescription` `removeDescription0​(SharedObjectTypeDescription n)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### instance

    protected static ISharedObjectFactory instance

### Constructor Detail

#### SharedObjectFactory

    protected SharedObjectFactory()

### Method Detail

#### getDefault

    public static ISharedObjectFactory getDefault()

#### addDescription

    public SharedObjectTypeDescription addDescription​(SharedObjectTypeDescription description)

Specified by:
  `addDescription` in interface `ISharedObjectFactory`

#### getDescriptions

    public List getDescriptions()

Description copied from interface: `ISharedObjectFactory`
Get a collection of the SharedObjectTypeDescriptions currently known to this factory. This allows clients to query the factory to determine what if any other SharedObjectTypeDescriptions are currently registered with the factory, and if so, what they are.

Specified by:
  `getDescriptions` in interface `ISharedObjectFactory`
Returns:
  List of SharedObjectTypeDescription instances. Will not be null.

#### getDescriptions0

    protected List getDescriptions0()

#### addDescription0

    protected SharedObjectTypeDescription addDescription0​(SharedObjectTypeDescription n)

#### containsDescription

    public boolean containsDescription​(SharedObjectTypeDescription scd)

Description copied from interface: `ISharedObjectFactory`
Check to see if a given named description is already contained by this factory

Specified by:
  `containsDescription` in interface `ISharedObjectFactory`
Parameters:
  `scd` - the SharedObjectTypeDescription to look for
Returns:
  true if description is already known to factory, false otherwise

#### containsDescription0

    protected boolean containsDescription0​(SharedObjectTypeDescription scd)

#### getDescription0

    protected SharedObjectTypeDescription getDescription0​(SharedObjectTypeDescription scd)

#### getDescription0

    protected SharedObjectTypeDescription getDescription0​(String name)

#### getDescriptionByName

    public SharedObjectTypeDescription getDescriptionByName​(String name)
                                                     throws SharedObjectCreateException

Description copied from interface: `ISharedObjectFactory`
Get the known SharedObjectTypeDescription given it's name.

Specified by:
  `getDescriptionByName` in interface `ISharedObjectFactory`
Returns:
  SharedObjectTypeDescription found. Null if description not found.
Throws:
  `SharedObjectCreateException`

#### createSharedObject

    public ISharedObject createSharedObject​(SharedObjectTypeDescription desc,
                                            Object[] args)
                                     throws SharedObjectCreateException

Description copied from interface: `ISharedObjectFactory`
Create ISharedObject instance. Given a SharedObjectTypeDescription object, a String [] of argument types, and an Object [] of parameters, this method will

- lookup the known SharedObjectTypeDescriptions to find one of matching name
- if found, will retrieve or create an ISharedObjectInstantiator for that description
- Call the ISharedObjectInstantiator.createInstance method to return an instance of ISharedObject

Specified by:
  `createSharedObject` in interface `ISharedObjectFactory`
Parameters:
  `desc` - the SharedObjectTypeDescription to use to create the instance
  `args` - an Object [] of arguments passed to the createInstance method of the ISharedObjectInstantiator
Returns:
  a valid instance of ISharedObject. Will not be null.
Throws:
  `SharedObjectCreateException` - if shared object cannot be created

#### createSharedObject

    public ISharedObject createSharedObject​(String descriptionName)
                                     throws SharedObjectCreateException

Description copied from interface: `ISharedObjectFactory`
Create ISharedObject instance. Given a SharedObjectTypeDescription name, this method will

- lookup the known SharedObjectTypeDescriptions to find one of matching name
- if found, will retrieve or create an ISharedObjectInstantiator for that description
- Call the ISharedObjectInstantiator.createInstance method to return an instance of ISharedObject

Specified by:
  `createSharedObject` in interface `ISharedObjectFactory`
Parameters:
  `descriptionName` - the SharedObjectTypeDescription name to lookup
Returns:
  a valid instance of ISharedObject. Will not be null.
Throws:
  `SharedObjectCreateException`

#### createSharedObject

    public ISharedObject createSharedObject​(String descriptionName,
                                            Object[] args)
                                     throws SharedObjectCreateException

Description copied from interface: `ISharedObjectFactory`
Create ISharedObject instance. Given a SharedObjectTypeDescription name, this method will

- lookup the known SharedObjectTypeDescriptions to find one of matching name
- if found, will retrieve or create an ISharedObjectInstantiator for that description
- Call the ISharedObjectInstantiator.createInstance method to return an instance of ISharedObject

Specified by:
  `createSharedObject` in interface `ISharedObjectFactory`
Parameters:
  `descriptionName` - the SharedObjectTypeDescription name to lookup
  `args` - the Object [] of arguments passed to the ISharedObjectInstantiator.createInstance method
Returns:
  a valid instance of IContainer. Will not be null.
Throws:
  `SharedObjectCreateException`

#### removeDescription

    public SharedObjectTypeDescription removeDescription​(SharedObjectTypeDescription scd)

Description copied from interface: `ISharedObjectFactory`
Remove given description from set known to this factory.

Specified by:
  `removeDescription` in interface `ISharedObjectFactory`
Parameters:
  `scd` - the SharedObjectTypeDescription to remove
Returns:
  the removed SharedObjectTypeDescription, null if nothing removed

#### removeDescription0

    protected SharedObjectTypeDescription removeDescription0​(SharedObjectTypeDescription n)