public final class ServiceUtils
extends java.lang.Object
ServiceUtils
but it would actually work with anything, not only service implementations.Modifier and Type | Method and Description |
---|---|
static <T> java.util.Collection<T> |
findAmongst(java.lang.Class<T> clazz,
java.util.Collection<?> instances)
Find instances of
clazz among the instances . |
static <T> java.util.Collection<T> |
findAmongst(java.lang.Class<T> clazz,
java.lang.Object... instances)
Find instances of
clazz among the instances . |
static <T> java.util.Optional<T> |
findOptionalAmongst(java.lang.Class<T> clazz,
java.util.Collection<?> instances)
Find the only expected instance of
clazz among the instances . |
static <T> java.util.Optional<T> |
findOptionalAmongst(java.lang.Class<T> clazz,
java.lang.Object... instances)
Find the only expected instance of
clazz among the instances . |
static <T> T |
findSingletonAmongst(java.lang.Class<T> clazz,
java.util.Collection<?> instances)
Find the only expected instance of
clazz among the instances . |
static <T> T |
findSingletonAmongst(java.lang.Class<T> clazz,
java.lang.Object... instances)
Find the only expected instance of
clazz among the instances . |
public static <T> java.util.Collection<T> findAmongst(java.lang.Class<T> clazz, java.util.Collection<?> instances)
clazz
among the instances
.T
- type of the searched instancesclazz
- searched classinstances
- instances looked atpublic static <T> java.util.Collection<T> findAmongst(java.lang.Class<T> clazz, java.lang.Object... instances)
clazz
among the instances
.T
- type of the searched instancesclazz
- searched classinstances
- instances looked atpublic static <T> T findSingletonAmongst(java.lang.Class<T> clazz, java.util.Collection<?> instances)
clazz
among the instances
.T
- type of the searched instanceclazz
- searched classinstances
- instances looked atjava.lang.IllegalArgumentException
- if more than one matching instancepublic static <T> java.util.Optional<T> findOptionalAmongst(java.lang.Class<T> clazz, java.util.Collection<?> instances)
clazz
among the instances
.T
- type of the searched instanceclazz
- searched classinstances
- instances looked atjava.lang.IllegalArgumentException
- if more than one matching instancepublic static <T> T findSingletonAmongst(java.lang.Class<T> clazz, java.lang.Object... instances)
clazz
among the instances
.T
- type of the searched instanceclazz
- searched classinstances
- instances looked atjava.lang.IllegalArgumentException
- if more than one matching instancepublic static <T> java.util.Optional<T> findOptionalAmongst(java.lang.Class<T> clazz, java.lang.Object... instances)
clazz
among the instances
.T
- type of the searched instanceclazz
- searched classinstances
- instances looked atjava.lang.IllegalArgumentException
- if more than one matching instance