Interface ConfigurationResource<T>
- All Superinterfaces:
AutoCloseable,Supplier<T>
Represents a configuration resource. If the resource is a
AutoCloseable, then invoking AutoCloseable.close() on
this resource will close the resource.- Author:
- James R. Perkins
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic <T> ConfigurationResource<T> 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 Details
-
of
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
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
-