tech.kronicle.utils.ObjectReference Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kronicle-utils Show documentation
Show all versions of kronicle-utils Show documentation
Kronicle utils library that contains utility classes for use by Kronicle and its plugins
package tech.kronicle.utils;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import java.util.function.UnaryOperator;
import static java.util.Objects.nonNull;
@NoArgsConstructor
@AllArgsConstructor
public final class ObjectReference {
private T value;
public T get() {
return value;
}
public void set(T value) {
this.value = value;
}
public void set(UnaryOperator mapper) {
this.value = mapper.apply(this.value);
}
public void clear() {
this.value = null;
}
public boolean isPresent() {
return nonNull(value);
}
public boolean isEmpty() {
return !isPresent();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy