public class InitializationState extends Object
requireNotInitilized()
that can be called before initialization
e.g. from injection-setters
so nothing can be re-injected after
initialization
. Additionally there is requireInitilized()
that can be
called after initialization e.g. from functional methods of the component to ensure that the component has
been initialized
.PostConstruct
Modifier and Type | Field and Description |
---|---|
private AtomicInteger |
state
This field holds the atomic state of this object.
|
private static int |
STATE_INITIALIZED
The
state if initialization has completed. |
private static int |
STATE_INITIALIZING
The
state during initialization . |
private static int |
STATE_UNINITIALIZED
The initial
state . |
Constructor and Description |
---|
InitializationState()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isInitialized()
This method gets the status of the
initialization . |
void |
requireInitilized()
This method checks that this state has already been
initialized . |
void |
requireNotInitilized()
This method checks that this state has NOT yet been
initialized . |
void |
setInitialized()
This method sets the state to
initialized . |
boolean |
setInitializing()
This method sets the state to initializing.
|
private static final int STATE_UNINITIALIZED
state
.private static final int STATE_INITIALIZING
state
during initialization
.private static final int STATE_INITIALIZED
state
if initialization
has completed.private AtomicInteger state
public boolean setInitializing()
setInitialized()
should be invoked.true
if the state was NOT initialized
and is now
initialized
, false
if the state is already
initialized
.public void setInitialized()
initialized
. setInitializing()
before you invoke this method!public boolean isInitialized()
initialization
.true
if this component has been initialized
,
false
otherwise.public void requireInitilized() throws NotInitializedException
initialized
.NotInitializedException
- if this state has NOT been initialized yet.public void requireNotInitilized() throws AlreadyInitializedException
initialized
.AlreadyInitializedException
- if this state has already been initialized.Copyright © 2001–2014 mmm-Team. All rights reserved.