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

## Class AbstractDeclaration

- java.lang.Object
- - org.apache.felix.ipojo.extender.internal.AbstractService
  - - org.apache.felix.ipojo.extender.internal.declaration.AbstractDeclaration

All Implemented Interfaces:
  Declaration, DeclarationHandle, Lifecycle, Status

Direct Known Subclasses:
  DefaultExtensionDeclaration, DefaultInstanceDeclaration, DefaultTypeDeclaration

    public abstract class AbstractDeclaration
    extends AbstractService
    implements Declaration, DeclarationHandle, Status

Common code to all Declaration objects.

### Field Summary

Fields
`static java.lang.String` `DECLARATION_BOUND_MESSAGE` The message used when a declaration is bound.

### Fields inherited from class org.apache.felix.ipojo.extender.internal.AbstractService

`m_bundleContext`

### Constructor Summary

Constructors
`protected` `AbstractDeclaration(org.osgi.framework.BundleContext bundleContext, java.lang.Class<?> type)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `bind()` Binds the declaration.
`java.lang.String` `getMessage()` Gets the unbound message if any.
`Status` `getStatus()` Gets the status of the declaration.
`java.lang.Throwable` `getThrowable()` Gets the unbound error if any.
`boolean` `isBound()` Is the declaration fulfilled ?
`void` `publish()` Publish the `Declaration`.
`void` `retract()` Retract the `Declaration` service.
`void` `unbind(java.lang.String message)` Unbinds the declaration.
`void` `unbind(java.lang.String message, java.lang.Throwable throwable)` Unbinds the declaration.

### Methods inherited from class org.apache.felix.ipojo.extender.internal.AbstractService

`getBundleContext, getRegistration, getServiceProperties, isRegistered, registerService, start, stop`

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

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

### Field Detail

#### DECLARATION_BOUND_MESSAGE

    public static final java.lang.String DECLARATION_BOUND_MESSAGE

The message used when a declaration is bound.

See Also:
  Constant Field Values

### Constructor Detail

#### AbstractDeclaration

    protected AbstractDeclaration(org.osgi.framework.BundleContext bundleContext,
                                  java.lang.Class<?> type)

### Method Detail

#### isBound

    public boolean isBound()

Description copied from interface: `Status`
Is the declaration fulfilled ?

Specified by:
  `isBound` in interface `Status`
Returns:
  whether the declaration is bound or not.

#### getMessage

    public java.lang.String getMessage()

Description copied from interface: `Status`
Gets the unbound message if any.

Specified by:
  `getMessage` in interface `Status`
Returns:
  the message. The message contains the not-bound reason.

#### getThrowable

    public java.lang.Throwable getThrowable()

Description copied from interface: `Status`
Gets the unbound error if any.

Specified by:
  `getThrowable` in interface `Status`
Returns:
  the error if something went wrong during the binding process.

#### getStatus

    public Status getStatus()

Gets the status of the declaration. This method returns an immutable object.

Specified by:
  `getStatus` in interface `Declaration`
Specified by:
  `getStatus` in interface `DeclarationHandle`
Returns:
  the declaration status.

#### bind

    public void bind()

Binds the declaration. This method just set the status, message and error.

Specified by:
  `bind` in interface `Declaration`

#### unbind

    public void unbind(java.lang.String message)

Unbinds the declaration.

Specified by:
  `unbind` in interface `Declaration`
Parameters:
  `message` - an explanation
See Also:
  `unbind(String, Throwable)`

#### unbind

    public void unbind(java.lang.String message,
                       java.lang.Throwable throwable)

Unbinds the declaration. The flag, message and error are set.

Specified by:
  `unbind` in interface `Declaration`
Parameters:
  `message` - an explanation
  `throwable` - an error

#### publish

    public void publish()

Description copied from interface: `DeclarationHandle`
Publish the `Declaration`. If the declaration is already registered, it's a no-op operation.

Specified by:
  `publish` in interface `DeclarationHandle`

#### retract

    public void retract()

Description copied from interface: `DeclarationHandle`
Retract the `Declaration` service. If the declaration is not registered, it's a no-op operation.

Specified by:
  `retract` in interface `DeclarationHandle`