All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.larssh.utils.AutoCompletable Maven / Gradle / Ivy

// Generated by delombok at Fri Jun 21 12:50:11 UTC 2024
package de.larssh.utils;

/**
 * This class implements a boolean {@code completed} status, allowing objects to
 * differentiate between an initialization phase and their final value.
 *
 * 

* In addition to {@link Completable} it implements {@link AutoCloseable} to * allow simplified factory methods using try-with-resource statement. * *

* Each getter is recommended to call {@code #complete()}, while setters must * call {@code #throwIfCompleted()} prior to modification. * *

* Before using {@code AutoCompletable} think about using either a streamlined * constructor or a builder class. * *

* Example: {@code SomeFancyThing} is of type {@code AutoCloseable}. The * method {@code getSomeFancyThing()} is meant to initialize * {@code SomeFancyThing} while it should no longer be modifiable outside that * method. * *

 * SomeFancyThing getSomeFanyThing() {
 * 	try (SomeFancyThing someFanyThing = new SomeFancyThing()) {
 * 		...
 * 		return someFanyThing;
 * 	}
 * }
 * 
*/ public abstract class AutoCompletable extends Completable implements AutoCloseable { /** * Calls {@link Completable#complete()} to finish the objects initialization * phase. */ @Override public void close() { complete(); } @java.lang.SuppressWarnings("all") @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(justification = "generated code") @lombok.Generated public AutoCompletable() { } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy