com.infomaximum.cluster.graphql.struct.GOptional Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cluster-graphql Show documentation
Show all versions of cluster-graphql Show documentation
Library for creating a light cluster
The newest version!
package com.infomaximum.cluster.graphql.struct;
/**
* Created by kris on 06.03.17.
*/
public final class GOptional {
private static final GOptional NOT_PRESENT = new GOptional(null, false);
private final T value;
private final boolean isPresent;
public GOptional(T value, boolean isPresent) {
this.value = value;
this.isPresent = isPresent;
}
public T get() {
return value;
}
public boolean isPresent() {
return isPresent;
}
@SuppressWarnings("unchecked")
public static final GOptional notPresent() {
return (GOptional) NOT_PRESENT;
}
public static final GOptional of(T value) {
return new GOptional(value, true);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy