Package net.shibboleth.shared.component

# Class AbstractIdentifiedInitializableComponent

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `IdentifiedComponent`, `InitializableComponent`

Direct Known Subclasses:
  `AbstractIdentifiableInitializableComponent`, `ConditionalResource`, `HTTPResource`

@ThreadSafe public abstract class AbstractIdentifiedInitializableComponent extends AbstractInitializableComponent implements IdentifiedComponent
Simple implementation of `InitializableComponent` and `IdentifiedComponent`.

## Field Summary

Fields
Modifier and Type
Field
Description
`private String`
`id`
The unique identifier for this component.

## Constructor Summary

Constructors
Constructor
Description
`AbstractIdentifiedInitializableComponent()`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doInitialize()`
This method checks to ensure that the component ID is not null.
`final String`
`ensureId()`
Return the ID of this component, guaranteeing a non-`null` result.
`String`
`getId()`
Get the ID of this component.
`protected final void`
`ifDestroyedThrowDestroyedComponentException()`
Checks if the component is destroyed and, if so, throws a `DestroyedComponentException`.
`protected final void`
`ifInitializedThrowUnmodifiabledComponentException()`
Checks if a component has been initialized and, if so, throws a `UnmodifiableComponentException`.
`protected final void`
`ifNotInitializedThrowUninitializedComponentException()`
Checks if a component has not been initialized and, if so, throws a `UninitializedComponentException`.
`protected void`
`setId(String componentId)`
Sets the ID of this component.

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitialized`

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

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

## Field Details

### id

@NonnullAfterInit private String id
The unique identifier for this component.

## Constructor Details

### AbstractIdentifiedInitializableComponent

public AbstractIdentifiedInitializableComponent()

## Method Details

### getId

@NonnullAfterInit @NotEmpty public String getId()
Get the ID of this component.

Specified by:
  `getId` in interface `IdentifiedComponent`
Returns:
  ID of this component or null

### ensureId

@Nonnull public final String ensureId()
Return the ID of this component, guaranteeing a non-`null` result.

Returns:
  the ID of this component, never `null`
Throws:
  `IllegalStateException` - if called before the ID has been set
Since:
  9.0.0
See Also:
  - `getId()`

### ifDestroyedThrowDestroyedComponentException

protected final void ifDestroyedThrowDestroyedComponentException()
Checks if the component is destroyed and, if so, throws a `DestroyedComponentException`.

Overrides:
  `ifDestroyedThrowDestroyedComponentException` in class `AbstractInitializableComponent`

### ifNotInitializedThrowUninitializedComponentException

protected final void ifNotInitializedThrowUninitializedComponentException()
Checks if a component has not been initialized and, if so, throws a `UninitializedComponentException`.

Overrides:
  `ifNotInitializedThrowUninitializedComponentException` in class `AbstractInitializableComponent`

### ifInitializedThrowUnmodifiabledComponentException

protected final void ifInitializedThrowUnmodifiabledComponentException()
Checks if a component has been initialized and, if so, throws a `UnmodifiableComponentException`.

Overrides:
  `ifInitializedThrowUnmodifiabledComponentException` in class `AbstractInitializableComponent`

### setId

protected void setId(@Nonnull @NotEmpty String componentId)
Sets the ID of this component. The component must not yet be initialized.

Parameters:
  `componentId` - ID of the component

### doInitialize

protected void doInitialize() throws ComponentInitializationException
This method checks to ensure that the component ID is not null. Performs the initialization of the component. This method is executed within the lock on the object being initialized. The default implementation of this method is a no-op.

Overrides:
  `doInitialize` in class `AbstractInitializableComponent`
Throws:
  `ComponentInitializationException` - thrown if there is a problem initializing the component