java.lang.Object
io.jenetics.internal.util.Lifecycle
Interfaces and classes for handling resource (
 
 
AutoCloseable) objects.
 The common use cases are shown as follows:
 Wrapping non-closeable values
 final Value<Path, IOException> file = new Value<>(
     Files.createFile(Path.of("some_file")),
     Files::deleteIfExists
 );
 // Automatically delete the file after the test.
 try (file) {
     Files.write(file.get(), "foo".getBytes());
     final var writtenText = Files.readString(file.get());
     assert "foo".equals(writtenText);
 }Building complex closeable values
 final IOValue<Stream<Object>> result = new IOValue<>(resources -> {
     final var fin = resources.add(new FileInputStream(file.toFile()));
     final var bin = resources.add(new BufferedInputStream(fin));
     final var oin = resources.add(new ObjectInputStream(bin));
     return Stream.generate(() -> readNextObject(oin))
         .takeWhile(Objects::nonNull);
 });
 try (result) {
     result.get().forEach(System.out::println);
 }Wrapping several closeables into one
 try (var __ = ExtendedCloseable.of(c1, c2, c3)) {
     ...
 }- Since:
 - 6.2
 - Version:
 - 7.2
 
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceLifecycle.ExtendedCloseable<E extends Exception>Extends theAutoCloseablewith methods for wrapping the thrown exception into unchecked exceptions or ignoring them.static final classThis class allows collecting one or moreAutoCloseableobjects into one.static final classThis class represents a closeable value.static classLifecycle.Resources<E extends Exception>This class allows collecting one or moreAutoCloseableobjects into one.static interfaceLifecycle.ThrowingConsumer<A,E extends Exception> A method which takes an argument and can throw an exception.static interfaceLifecycle.ThrowingFunction<A,R, E extends Exception> A function which takes an argument and can throw an exception.static interfaceLifecycle.ThrowingRunnable<E extends Exception>Runnable task/method, which might throw an exceptionE.static classLifecycle.Value<T,E extends Exception> This class represents a closeable value. - 
Method Summary