org.apache.felix.ipojo.extender.internal.declaration.service

## Class DefaultInstanceBuilder

- java.lang.Object
- - org.apache.felix.ipojo.extender.internal.declaration.service.DefaultInstanceBuilder

All Implemented Interfaces:
  InstanceBuilder

    public class DefaultInstanceBuilder
    extends java.lang.Object
    implements InstanceBuilder

User: guillaume Date: 13/02/2014 Time: 09:36

### Constructor Summary

Constructors
Constructor and Description
`DefaultInstanceBuilder(org.osgi.framework.BundleContext context, java.lang.String type)`

### Method Summary

All Methods Instance Methods Concrete Methods
`DeclarationHandle` `build()` Build the declaration handle (never contains any configuration).
`DeclarationHandle` `build(java.util.Dictionary<java.lang.String,java.lang.Object> configuration)` Only called through ConfigurationBuilder to apply the created configuration to this instance
`ConfigurationBuilder` `configure()` Access the dedicated builder for configuration (properties).
`InstanceBuilder` `context(org.osgi.framework.BundleContext context)` Override the default BundleContext used for declaration service registration.
`InstanceBuilder` `name(java.lang.String name)` Specify the instance name.
`InstanceBuilder` `type(java.lang.Class<?> type)` Specify the component's type of this instance.
`InstanceBuilder` `type(java.lang.String type)` Specify the component's type of this instance.
`InstanceBuilder` `version(java.lang.String version)` Specify the component's version of this instance.

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

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

### Constructor Detail

#### DefaultInstanceBuilder

    public DefaultInstanceBuilder(org.osgi.framework.BundleContext context,
                                  java.lang.String type)

### Method Detail

#### name

    public InstanceBuilder name(java.lang.String name)

Description copied from interface: `InstanceBuilder`
Specify the instance name. Using null will result in an anonymous instance.

Specified by:
  `name` in interface `InstanceBuilder`
Parameters:
  `name` - instance name or null
Returns:
  this builder

#### type

    public InstanceBuilder type(java.lang.String type)

Description copied from interface: `InstanceBuilder`
Specify the component's type of this instance.

Specified by:
  `type` in interface `InstanceBuilder`
Parameters:
  `type` - type of the instance (cannot be null).
Returns:
  this builder

#### type

    public InstanceBuilder type(java.lang.Class<?> type)

Description copied from interface: `InstanceBuilder`
Specify the component's type of this instance.

Specified by:
  `type` in interface `InstanceBuilder`
Parameters:
  `type` - type of the instance (cannot be null).
Returns:
  this builder

#### version

    public InstanceBuilder version(java.lang.String version)

Description copied from interface: `InstanceBuilder`
Specify the component's version of this instance. If null is used, the factory without any version attribute will be used.

Specified by:
  `version` in interface `InstanceBuilder`
Parameters:
  `version` - component's version (can be null).
Returns:
  this builder

#### context

    public InstanceBuilder context(org.osgi.framework.BundleContext context)

Description copied from interface: `InstanceBuilder`
Override the default BundleContext used for declaration service registration. Use this with <bold>caution</bold>, for example, if the bundle does not import the ``org.apache.felix.ipojo.extender`` package, declarations may not be linked and activated properly.

Specified by:
  `context` in interface `InstanceBuilder`
Parameters:
  `context` - new context to be used.
Returns:
  this builder

#### configure

    public ConfigurationBuilder configure()

Description copied from interface: `InstanceBuilder`
Access the dedicated builder for configuration (properties). Notice that when this method is used, the called must use `ConfigurationBuilder.build()` to build the instance declaration configured with the right set of properties. Any attempt to use `InstanceBuilder.build()` will result in a new declaration with no properties associated. Good usage (produced declaration has the associated properties):

         DeclarationHandle handle = builder.configure()
                                                .property("hello", "world")
                                                .build();

Bad usage (produced declaration does not have the associated properties):

         builder.configure()
                    .property("hello", "world");

         DeclarationHandle handle = builder.build();

Specified by:
  `configure` in interface `InstanceBuilder`
Returns:
  the instance configuration builder

#### build

    public DeclarationHandle build(java.util.Dictionary<java.lang.String,java.lang.Object> configuration)

Only called through ConfigurationBuilder to apply the created configuration to this instance

Parameters:
  `configuration` -

#### build

    public DeclarationHandle build()

Description copied from interface: `InstanceBuilder`
Build the declaration handle (never contains any configuration). Notice that the declaration is not yet published (no automatic activation). The client has to do it through `DeclarationHandle.publish()`

Specified by:
  `build` in interface `InstanceBuilder`
Returns:
  the handle to the declaration