@FunctionalInterface public interface NamedResource
| Modifier and Type | Field and Description |
|---|---|
static Comparator<NamedResource> |
BY_NAME_COMPARATOR
Compares 2
NamedResources according to their getName() value case insensitive |
static Function<NamedResource,String> |
NAME_EXTRACTOR
|
| Modifier and Type | Method and Description |
|---|---|
static <R extends NamedResource> |
findByName(String name,
Comparator<? super String> c,
Collection<? extends R> resources) |
static <R extends NamedResource> |
findFirstMatchByName(Collection<String> names,
Comparator<? super String> c,
Collection<? extends R> resources) |
String |
getName() |
static List<String> |
getNameList(Collection<? extends NamedResource> resources) |
static String |
getNames(Collection<? extends NamedResource> resources) |
static NamedResource |
ofName(String name)
Wraps a name value inside a
NamedResource |
static <R extends NamedResource> |
removeByName(String name,
Comparator<? super String> c,
Collection<? extends R> resources)
Remove the resource identified by the name from the list.
|
static int |
safeCompareByName(NamedResource r1,
NamedResource r2,
boolean caseSensitive) |
static final Function<NamedResource,String> NAME_EXTRACTOR
static final Comparator<NamedResource> BY_NAME_COMPARATOR
NamedResources according to their getName() value case insensitiveString getName()
static List<String> getNameList(Collection<? extends NamedResource> resources)
resources - The named resourcesList of all the factories names - in same order as they appear in the input
collectionstatic String getNames(Collection<? extends NamedResource> resources)
resources - list of available resourcesstatic <R extends NamedResource> R removeByName(String name, Comparator<? super String> c, Collection<? extends R> resources)
R - The generic resource typename - Name of the resource - ignored if null/emptyc - The Comparator to decide whether the getName() matches the
name parameterresources - The NamedResource to check - ignored if null/emptynull if not in the liststatic <R extends NamedResource> R findByName(String name, Comparator<? super String> c, Collection<? extends R> resources)
R - The generic resource typename - Name of the resource - ignored if null/emptyc - The Comparator to decide whether the getName() matches the
name parameterresources - The NamedResource to check - ignored if null/emptyComparator.compare(Object, Object) - null if no match foundstatic <R extends NamedResource> R findFirstMatchByName(Collection<String> names, Comparator<? super String> c, Collection<? extends R> resources)
static NamedResource ofName(String name)
NamedResourcename - The name value to wrapstatic int safeCompareByName(NamedResource r1, NamedResource r2, boolean caseSensitive)
Copyright © 2018–2024 The Apache Software Foundation. All rights reserved.