This repository has been archived on 2023-01-02. You can view files and clone it, but cannot push or open issues or pull requests.
data-generator-runtime/src/main/java/it/cavallium/data/generator/NativeNullable.java

25 lines
461 B
Java
Raw Normal View History

2022-05-05 15:33:11 +02:00
package it.cavallium.data.generator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface NativeNullable<T> {
boolean isEmpty();
2022-05-06 10:07:33 +02:00
default boolean isPresent() {
return !isEmpty();
}
2022-05-05 15:33:11 +02:00
@NotNull
T orElse(@NotNull T defaultValue);
2022-05-06 10:07:33 +02:00
@NotNull NativeNullable<? extends T> or(@NotNull NativeNullable<? extends T> fallback);
2022-05-05 15:33:11 +02:00
@Nullable
T getNullable();
@Nullable
T getNullable(@Nullable T defaultValue);
}