@ParametersAreNonnullByDefault public final class Bindings extends Object
Modifier and Type | Method and Description |
---|---|
static <T> T |
find(Class<? super T> type,
Function<Class<? extends BackendFactory>,String> valueMapping,
String value,
String variant)
Retrieves the instance of the
type that is bound to a BackendFactory with the given value , by using the speficied valueMapping . |
static String |
nameOf(Class<?> type)
Retrieves the name for the specified
type . |
static String |
schemeOf(BackendFactory factory)
Retrieves the URI scheme for the specified
factory . |
static String |
schemeOf(Class<?> type)
Retrieves the URI scheme for the speficied
type . |
static Optional<String> |
variantOf(Class<?> type)
Retrieves the variant for the specified
type . |
@Nonnull public static String schemeOf(Class<?> type)
type
.
The type
must be annotated with FactoryBinding
, or implements BackendFactory
.
type
- the typeBindingException
- if no scheme is defined for this type
@Nonnull public static String schemeOf(BackendFactory factory)
factory
.factory
- the factoryBindingException
- if no scheme is defined for this type
@Nonnull public static String nameOf(Class<?> type)
type
.
The type
must be annotated with FactoryBinding
, or implements BackendFactory
.
type
- the typeBindingException
- if no name is defined for this type
@Nonnull public static Optional<String> variantOf(Class<?> type)
type
.
The type
must be annotated with FactoryBinding
.
type
- the type@Nonnull public static <T> T find(Class<? super T> type, Function<Class<? extends BackendFactory>,String> valueMapping, String value, @Nullable String variant)
type
that is bound to a BackendFactory
with the given value
, by using the speficied valueMapping
.
The type
must be annotated with FactoryBinding
.
T
- the type of the instancetype
- the type of the instance to look forvalueMapping
- the mapping function to retrieve the value from the factory bound by the annotationvalue
- the value to look forvariant
- the variant to look fortype
BindingException
- if no instance of type
is found for the value
by using the valueMapping
ServiceProvider.load(Class)
Copyright © 2013–2019 Atlanmod. All rights reserved.