Package org.apache.sshd.common
Interface AttributeStore
-
- All Superinterfaces:
AttributeRepository
- All Known Subinterfaces:
Channel
,ClientChannel
,ClientFactoryManager
,ClientSession
,FactoryManager
,ServerChannel
,ServerFactoryManager
,ServerSession
,Session
,SessionContext
- All Known Implementing Classes:
AbstractChannel
,AbstractClientChannel
,AbstractClientSession
,AbstractFactoryManager
,AbstractServerChannel
,AbstractServerSession
,AbstractSession
,AgentForwardedChannel
,ChannelAgentForwarding
,ChannelDirectTcpip
,ChannelExec
,ChannelForwardedX11
,ChannelSession
,ChannelSession
,ChannelShell
,ChannelSubsystem
,ClientSessionImpl
,DefaultSftpClient.SftpChannelSubsystem
,DirectoryHandle
,FileHandle
,Handle
,PtyCapableChannelSession
,ServerSessionImpl
,SessionHelper
,SshClient
,SshServer
,TcpipClientChannel
,TcpipServerChannel
public interface AttributeStore extends AttributeRepository
Provides the capability to attach in-memory attributes to the entity- Author:
- Apache MINA SSHD Project
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.sshd.common.AttributeRepository
AttributeRepository.AttributeKey<T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
clearAttributes()
Removes all currently stored user-defined attributesdefault <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 tonull
), attempts to compute its value using the given mapping function and enters it into this map unlessnull
.<T> T
removeAttribute(AttributeRepository.AttributeKey<T> key)
Removes the user-defined attribute<T> T
setAttribute(AttributeRepository.AttributeKey<T> key, T value)
Sets a user-defined attribute.-
Methods inherited from interface org.apache.sshd.common.AttributeRepository
attributeKeys, getAttribute, getAttributesCount, resolveAttribute
-
-
-
-
Method Detail
-
computeAttributeIfAbsent
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 tonull
), attempts to compute its value using the given mapping function and enters it into this map unlessnull
.- Type Parameters:
T
- The generic attribute type- Parameters:
key
- The key of the attribute; must not benull
.resolver
- The (nevernull
) mapping function to use if value not already mapped. If returnsnull
then value is not mapped to the provided key.- Returns:
- The resolved value -
null
if value not mapped and resolver did not return a non-null
value for it
-
setAttribute
<T> T setAttribute(AttributeRepository.AttributeKey<T> key, T value)
Sets a user-defined attribute.- Type Parameters:
T
- The generic attribute type- Parameters:
key
- The key of the attribute; must not benull
.value
- The value of the attribute; must not benull
.- Returns:
- The old value of the attribute;
null
if it is new.
-
removeAttribute
<T> T removeAttribute(AttributeRepository.AttributeKey<T> key)
Removes the user-defined attribute- Type Parameters:
T
- The generic attribute type- Parameters:
key
- The key of the attribute; must not benull
.- Returns:
- The removed value;
null
if no previous value
-
clearAttributes
void clearAttributes()
Removes all currently stored user-defined attributes
-
-