Class OptionalFactoryResolver<T>
java.lang.Object
org.apache.logging.log4j.plugins.di.resolver.OptionalFactoryResolver<T>
- All Implemented Interfaces:
FactoryResolver<Optional<T>>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFactory
(ResolvableKey<Optional<T>> resolvableKey, InstanceFactory instanceFactory) Gets a factory for the given resolvable key using existing bindings from the given instance factory.boolean
supportsKey
(Key<?> key) Checks if this resolver supports the provided key.
-
Constructor Details
-
OptionalFactoryResolver
public OptionalFactoryResolver()
-
-
Method Details
-
supportsKey
Description copied from interface:FactoryResolver
Checks if this resolver supports the provided key. If this returnstrue
, then the factory returned byFactoryResolver.getFactory(ResolvableKey, InstanceFactory)
will be used to create a binding for the key.- Specified by:
supportsKey
in interfaceFactoryResolver<T>
- Parameters:
key
- the key to check for support- Returns:
- true if this resolver supports the key
-
getFactory
public Supplier<Optional<T>> getFactory(ResolvableKey<Optional<T>> resolvableKey, InstanceFactory instanceFactory) Description copied from interface:FactoryResolver
Gets a factory for the given resolvable key using existing bindings from the given instance factory. A resolvable key in this context is aKey
combined with alias names and the annotated element this factory is for.- Specified by:
getFactory
in interfaceFactoryResolver<T>
- Parameters:
resolvableKey
- the resolvable key to create a binding forinstanceFactory
- the existing instance factory to use for composing bindings- Returns:
- a factory for instances described by the provided key
-