Class LazyOpener<T>
java.lang.Object
com.apple.foundationdb.record.lucene.codec.LazyOpener<T>
- Type Parameters:
T- the type of object that the opener returns
Class to lazily "open" something that may throw an IOException when opening.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA function that returns an object, but may throw anIOException. -
Method Summary
Modifier and TypeMethodDescriptionget()Get the object returned by theopener.Get the object returned by theopener, throwingUncheckedIOExceptionif theLazyOpener.Opener.open()method threwIOException.static <U> LazyOpener<U>supply(LazyOpener.Opener<U> opener) Create a newLazyOpenerfor the givenLazyOpener.Opener.
-
Method Details
-
supply
Create a newLazyOpenerfor the givenLazyOpener.Opener.The
openerwill be called at most once; seeSuppliers.memoize(Supplier).- Type Parameters:
U- the return type of theopener- Parameters:
opener- a function to "open" a resource- Returns:
- a new lazily opened object
-
get
Get the object returned by theopener.- Returns:
- the object returned by the
opener - Throws:
IOException- if callingLazyOpener.Opener.open()threw anIOException
-
getUnchecked
Get the object returned by theopener, throwingUncheckedIOExceptionif theLazyOpener.Opener.open()method threwIOException.- Returns:
- the object returned by the
opener
-