K
- the type of the safe keys.public static interface PromptingKey.View<K extends PromptingKey<K>>
Implementations of this interface are maintained by a
PromptingKeyManager
.
Implementations must be safe for multi-threading!
Modifier and Type | Method and Description |
---|---|
void |
promptKeyForReading(PromptingKey.Controller<K> controller,
boolean invalid)
Prompts the user for the key for reading the contents of an
existing protected resource.
|
void |
promptKeyForWriting(PromptingKey.Controller<K> controller)
Prompts the user for the key for (over)writing the contents of a
new or existing protected resource.
|
void promptKeyForReading(PromptingKey.Controller<K> controller, boolean invalid) throws UnknownKeyException
key
property of the given
controller
.
If the implementation has called
PromptingKey.Controller.setKeyClone(K)
with a non-null
parameter, then a clone of this object will be used as the key.
Otherwise, if the implementation has called
PromptingKey.Controller.setKeyClone(K)
with a null
parameter or throws a KeyPromptingCancelledException
, then
prompting for the key is permanently disabled and each subsequent call
to PromptingKeyProvider.getKeyForWriting()
or
PromptingKeyProvider.getKeyForReading(boolean)
results in a
KeyPromptingCancelledException
until
PromptingKeyProvider.resetCancelledKey()
or
PromptingKeyProvider.resetUnconditionally()
gets
called.
Otherwise, the state of the key provider is not changed and this method gets called again.
controller
- The key controller for storing the result.invalid
- true
iff a previous call to this method
resulted in an invalid key.UnknownKeyException
- if key prompting fails for any reason.void promptKeyForWriting(PromptingKey.Controller<K> controller) throws UnknownKeyException
key
property of the given
controller
.
If the implementation has called
PromptingKey.Controller.setKeyClone(K)
with a non-null
parameter, then a clone of this object will be used as the key.
Otherwise, prompting for a key is permanently disabled and each
subsequent call to PromptingKeyProvider.getKeyForWriting()
or
PromptingKeyProvider.getKeyForReading(boolean)
results in a KeyPromptingCancelledException
until
PromptingKeyProvider.resetCancelledKey()
or
PromptingKeyProvider.resetUnconditionally()
gets
called.
controller
- The key controller for storing the result.UnknownKeyException
- if key prompting fails for any reason.Copyright © 2012–2018 Schlichtherle IT Services. All rights reserved.