Module org.jboss.logmanager
Interface ConfigurationResource<T>
-
- All Superinterfaces:
AutoCloseable,Supplier<T>
public interface ConfigurationResource<T> extends Supplier<T>, AutoCloseable
Represents a configuration resource. If the resource is aAutoCloseable, then invokingAutoCloseable.close()on this resource will close the resource.- Author:
- James R. Perkins
-
-
Method Summary
Static Methods Modifier and Type Method Description static <T> ConfigurationResource<T>of(Supplier<T> supplier)Creates a configuration resource which lazily invokes the supplier.static <T> ConfigurationResource<T>of(T instance)Creates a configuration resource with the instance as a constant.-
Methods inherited from interface java.lang.AutoCloseable
close
-
-
-
-
Method Detail
-
of
static <T> ConfigurationResource<T> of(Supplier<T> supplier)
Creates a configuration resource which lazily invokes the supplier. Note thatAutoCloseable.close()will only close the resource ifSupplier.get()was first invoked to retrieve the value from the supplier.- Parameters:
supplier- the supplier used to create the configuration resource- Returns:
- the configuration resource represented by a lazy instance
-
of
static <T> ConfigurationResource<T> of(T instance)
Creates a configuration resource with the instance as a constant. Note that ifAutoCloseable.close()is invoked,Supplier.get()will returnnull.- Parameters:
instance- the constant instance- Returns:
- the configuration resource represented by a constant instance
-
-