Closeable, AutoCloseable, Context<T>, nl.talsmasoftware.context.Context<T>public class LegacyContext<T> extends Object implements Context<T>, nl.talsmasoftware.context.Context<T>
| Modifier | Constructor | Description |
|---|---|---|
protected |
LegacyContext(nl.talsmasoftware.context.Context<T> wrapped) |
Deprecated.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Deprecated.
Closes this context and restores any context changes made by this object to the way things were before it
got created.
|
T |
getValue() |
Deprecated.
Returns the value associated with this context.
|
String |
toString() |
Deprecated.
|
static <T> Context<T> |
wrap(nl.talsmasoftware.context.Context<T> ctx) |
Deprecated.
|
protected LegacyContext(nl.talsmasoftware.context.Context<T> wrapped)
public static <T> Context<T> wrap(nl.talsmasoftware.context.Context<T> ctx)
public T getValue()
Context
Implementors should explicitly document the behaviour of this method after Context.close() was called.
For example, it may be useful to always return null after a Context has been
closed.
Contrary, it may in some cases be useful to retain the existing value after the context is closed,
so clients that have kept a reference can still have access to it.
Normally, for security-related contexts, it is wise to always return null from closed contexts.
public void close()
Context
It must be possible to call this method multiple times.
It is the responsibility of the implementor of this context to make sure that closing an already-closed context
has no unwanted side-effects.
A simple way to achieve this is by using an AtomicBoolean to make sure the
'closing' transition is executed only once.
Copyright © 2016–2018 Talsma ICT. All rights reserved.