Package org.apache.sshd.common
Interface NamedResource
- All Known Subinterfaces:
BuiltinFactory<T>,CipherFactory,Compression,CompressionFactory,CompressionInformation,DigestFactory,Identity,IoResource<T>,KexExtensionParser<T>,MacFactory,NamedFactory<T>,OpenSSHKdfOptions,Property<T>,Random,RandomFactory,SecurityProviderChoice,SecurityProviderRegistrar,SignatureFactory,UserAuthInstance<S>,UserAuthMethodFactory<S,M>
- All Known Implementing Classes:
AbstractIoResource,AbstractKexExtensionParser,AbstractRandom,AbstractRandomFactory,AbstractSecurityProviderRegistrar,BaseCompression,BCryptKdfOptions,BouncyCastleRandom,BouncyCastleRandomFactory,BouncyCastleSecurityProviderRegistrar,BuiltinCiphers,BuiltinCompressions,BuiltinDigests,BuiltinIdentities,BuiltinMacs,BuiltinSignatures,ClassLoaderResource,CompressionConfigValue,CompressionDelayedZlib,CompressionNone,CompressionZlib,DelayCompression,ECCurves,EdDSASecurityProviderRegistrar,Elevation,HostBoundPubkeyAuthentication,JceRandom,JceRandomFactory,KnownHostDigest,NoFlowControl,PathResource,Property.BaseProperty,Property.BooleanProperty,Property.CharsetProperty,Property.DurationInSecondsProperty,Property.DurationProperty,Property.EnumProperty,Property.IntegerProperty,Property.LongProperty,Property.ObjectProperty,Property.StringProperty,Property.Validating,RawKdfOptions,ServerSignatureAlgorithms,SingletonRandomFactory,SunJCESecurityProviderRegistrar,URIResource,URLResource
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
- Author:
- Apache MINA SSHD Project
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<NamedResource> Compares 2NamedResources according to theirgetName()value case insensitivestatic final Function<NamedResource, String> -
Method Summary
Modifier and TypeMethodDescriptionstatic <R extends NamedResource>
RfindByName(String name, Comparator<? super String> c, Collection<? extends R> resources) static <R extends NamedResource>
RfindFirstMatchByName(Collection<String> names, Comparator<? super String> c, Collection<? extends R> resources) getName()getNameList(Collection<? extends NamedResource> resources) static StringgetNames(Collection<? extends NamedResource> resources) static NamedResourceWraps a name value inside aNamedResourcestatic <R extends NamedResource>
RremoveByName(String name, Comparator<? super String> c, Collection<? extends R> resources) Remove the resource identified by the name from the list.static intsafeCompareByName(NamedResource r1, NamedResource r2, boolean caseSensitive)
-
Field Details
-
NAME_EXTRACTOR
-
BY_NAME_COMPARATOR
Compares 2NamedResources according to theirgetName()value case insensitive
-
-
Method Details
-
getName
String getName()- Returns:
- The resource name
-
getNameList
- Parameters:
resources- The named resources- Returns:
- A
Listof all the factories names - in same order as they appear in the input collection
-
getNames
- Parameters:
resources- list of available resources- Returns:
- A comma separated list of factory names
-
removeByName
static <R extends NamedResource> R removeByName(String name, Comparator<? super String> c, Collection<? extends R> resources) Remove the resource identified by the name from the list.- Type Parameters:
R- The generic resource type- Parameters:
name- Name of the resource - ignored ifnull/emptyc- TheComparatorto decide whether thegetName()matches the name parameterresources- TheNamedResourceto check - ignored ifnull/empty- Returns:
- the removed resource from the list or
nullif not in the list
-
findByName
static <R extends NamedResource> R findByName(String name, Comparator<? super String> c, Collection<? extends R> resources) - Type Parameters:
R- The generic resource type- Parameters:
name- Name of the resource - ignored ifnull/emptyc- TheComparatorto decide whether thegetName()matches the name parameterresources- TheNamedResourceto check - ignored ifnull/empty- Returns:
- The first resource whose name matches the parameter (by invoking
Comparator.compare(Object, Object)-nullif no match found
-
findFirstMatchByName
static <R extends NamedResource> R findFirstMatchByName(Collection<String> names, Comparator<? super String> c, Collection<? extends R> resources) -
ofName
Wraps a name value inside aNamedResource- Parameters:
name- The name value to wrap- Returns:
- The wrapper instance
-
safeCompareByName
-