Top Description Methods
org.apache.sshd.common

public Interface AttributeStore

extends AttributeRepository
Known Direct Subinterfaces
org.apache.sshd.common.session.SessionContext
Imports
java.util.Objects, java.util.function.Function

Provides the capability to attach in-memory attributes to the entity
Author
Apache MINA SSHD Project

Method Summary

Modifier and TypeMethod and Description
public void
clearAttributes()

Removes all currently stored user-defined attributes

public default <
The generic attribute type
T
>
T

Returns:

The resolved value - null if value not mapped and resolver did not return a non-null value for it
computeAttributeIfAbsent
(AttributeRepository.AttributeKey<T>
The key of the attribute; must not be null.
key
,
Function<? super AttributeRepository.AttributeKey<T>, ? extends T>
The (never null) mapping function to use if value not already mapped. If returns null then value is not mapped to the provided key.
resolver
)

If the specified key is not already associated with a value (or is mapped to null), attempts to compute its value using the given mapping function and enters it into this map unless null.

public <
The generic attribute type
T
>
T

Returns:

The removed value; null if no previous value
removeAttribute
(AttributeRepository.AttributeKey<T>
The key of the attribute; must not be null.
key
)

Removes the user-defined attribute

public <
The generic attribute type
T
>
T

Returns:

The old value of the attribute; null if it is new.
setAttribute
(AttributeRepository.AttributeKey<T>
The key of the attribute; must not be null.
key
,
T
The value of the attribute; must not be null.
value
)

Sets a user-defined attribute.

Inherited from org.apache.sshd.common.AttributeRepository:
attributeKeysgetAttributegetAttributesCountofAttributesMapofKeyValuePairresolveAttribute

Method Detail

clearAttributesback to summary
public void clearAttributes()

Removes all currently stored user-defined attributes

computeAttributeIfAbsentback to summary
public default <T> T computeAttributeIfAbsent(AttributeRepository.AttributeKey<T> key, Function<? super AttributeRepository.AttributeKey<T>, ? extends T> resolver)

If the specified key is not already associated with a value (or is mapped to null), attempts to compute its value using the given mapping function and enters it into this map unless null.

Parameters
<T>
The generic attribute type
key:AttributeRepository.AttributeKey<T>

The key of the attribute; must not be null.

resolver:Function<? super AttributeRepository.AttributeKey<T>, ? extends T>

The (never null) mapping function to use if value not already mapped. If returns null then value is not mapped to the provided key.

Returns:T

The resolved value - null if value not mapped and resolver did not return a non-null value for it

removeAttributeback to summary
public <T> T removeAttribute(AttributeRepository.AttributeKey<T> key)

Removes the user-defined attribute

Parameters
<T>
The generic attribute type
key:AttributeRepository.AttributeKey<T>

The key of the attribute; must not be null.

Returns:T

The removed value; null if no previous value

setAttributeback to summary
public <T> T setAttribute(AttributeRepository.AttributeKey<T> key, T value)

Sets a user-defined attribute.

Parameters
<T>
The generic attribute type
key:AttributeRepository.AttributeKey<T>

The key of the attribute; must not be null.

value:T

The value of the attribute; must not be null.

Returns:T

The old value of the attribute; null if it is new.