Class OptionalFactoryResolver<T>

java.lang.Object
org.apache.logging.log4j.plugins.di.resolver.OptionalFactoryResolver<T>
All Implemented Interfaces:
FactoryResolver<Optional<T>>

public class OptionalFactoryResolver<T> extends Object implements FactoryResolver<Optional<T>>
  • Constructor Details

    • OptionalFactoryResolver

      public OptionalFactoryResolver()
  • Method Details

    • supportsKey

      public boolean supportsKey(Key<?> key)
      Description copied from interface: FactoryResolver
      Checks if this resolver supports the provided key. If this returns true, then the factory returned by FactoryResolver.getFactory(ResolvableKey, InstanceFactory) will be used to create a binding for the key.
      Specified by:
      supportsKey in interface FactoryResolver<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 a Key combined with alias names and the annotated element this factory is for.
      Specified by:
      getFactory in interface FactoryResolver<T>
      Parameters:
      resolvableKey - the resolvable key to create a binding for
      instanceFactory - the existing instance factory to use for composing bindings
      Returns:
      a factory for instances described by the provided key