net.shibboleth.utilities.java.support.component
Class ComponentSupport

java.lang.Object
  extended by net.shibboleth.utilities.java.support.component.ComponentSupport

public final class ComponentSupport
extends Object

Support class for working with Component objects.


Constructor Summary
private ComponentSupport()
          Constructor.
 
Method Summary
static void destroy(Object obj)
          If the given object is not null and an instance of DestructableComponent, then this method calls the given object's DestructableComponent.destroy() method.
static void ifDestroyedThrowDestroyedComponentException(DestructableComponent component)
          Checks if a component is destroyed and, if so, throws a DestroyedComponentException.
static void ifInitializedThrowUnmodifiabledComponentException(InitializableComponent component)
          Checks if a component has been initialized and, if so, throws a UnmodifiableComponentException.
static void ifNotInitializedThrowUninitializedComponentException(InitializableComponent component)
          Checks if a component has not been initialized and, if so, throws a UninitializedComponentException.
static void initialize(Object obj)
          If the given object is not null and an instance of InitializableComponent, then this method calls the given object's InitializableComponent.initialize() method.
static void validate(Object obj)
          If the given object is not null and an instance of ValidatableComponent, then this method calls the given object's ValidatableComponent.validate() method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentSupport

private ComponentSupport()
Constructor.

Method Detail

destroy

public static void destroy(@Nullable
                           Object obj)
If the given object is not null and an instance of DestructableComponent, then this method calls the given object's DestructableComponent.destroy() method.

Parameters:
obj - object to destroy, may be null

initialize

public static void initialize(@Nullable
                              Object obj)
                       throws ComponentInitializationException
If the given object is not null and an instance of InitializableComponent, then this method calls the given object's InitializableComponent.initialize() method.

Parameters:
obj - object to initialize, may be null
Throws:
ComponentInitializationException - thrown if there is a problem initializing the object

validate

public static void validate(@Nullable
                            Object obj)
                     throws ComponentValidationException
If the given object is not null and an instance of ValidatableComponent, then this method calls the given object's ValidatableComponent.validate() method.

Parameters:
obj - object to validate, may be null
Throws:
ComponentValidationException - thrown if there is a problem validating the object

ifDestroyedThrowDestroyedComponentException

public static void ifDestroyedThrowDestroyedComponentException(@Nonnull
                                                               DestructableComponent component)
Checks if a component is destroyed and, if so, throws a DestroyedComponentException. If the component is also an instance of IdentifiableComponent, the component's ID is included in the error message.

Parameters:
component - component to check

ifNotInitializedThrowUninitializedComponentException

public static void ifNotInitializedThrowUninitializedComponentException(@Nonnull
                                                                        InitializableComponent component)
Checks if a component has not been initialized and, if so, throws a UninitializedComponentException. If the component is also an instance of IdentifiableComponent, the component's ID is included in the error message.

Parameters:
component - component to check

ifInitializedThrowUnmodifiabledComponentException

public static void ifInitializedThrowUnmodifiabledComponentException(@Nullable
                                                                     InitializableComponent component)
Checks if a component has been initialized and, if so, throws a UnmodifiableComponentException. If the component is also an instance of IdentifiableComponent, the component's ID is included in the error message.

Parameters:
component - component to check


Copyright © 1999-2012. All Rights Reserved.