public interface Contextual
Modifier and Type | Method and Description |
---|---|
Context |
context()
Gets the application context to which the object belongs.
|
Context |
getContext()
Gets the application context to which the object belongs, or null if
setContext(Context) has not yet been called on this object. |
default void |
setContext(Context context)
Sets the application context to which the object belongs.
|
Context context()
NullContextException
- if the context has not yet been set via
setContext(Context)
.getContext()
Context getContext()
setContext(Context)
has not yet been called on this object.context()
default void setContext(Context context)
Typically this method simply delegates to Context.inject(Object)
,
and should be called only once to populate the context. Most contextual
objects do not support later alteration of the context, and will throw
IllegalStateException
if this method is invoked again.
IllegalStateException
- If the object already has a context.IllegalArgumentException
- If the object has a required
Service
parameter (see Parameter.required()
)
which is not available from the context.Context.inject(Object)
Copyright © 2015–2022 SciJava. All rights reserved.