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

com.github.gpluscb.ggjava.entity.object.response.scalars.ScalarResponse Maven / Gradle / Ivy

The newest version!
package com.github.gpluscb.ggjava.entity.object.response.scalars;

import com.github.gpluscb.ggjava.entity.EntityType;
import com.github.gpluscb.ggjava.entity.object.response.AbstractGGResponseObject;
import com.github.gpluscb.ggjava.internal.utils.Checks;

import javax.annotation.Nonnull;

public abstract class ScalarResponse extends AbstractGGResponseObject {
	private final T value;

	public ScalarResponse(@Nonnull EntityType type, @Nonnull T value) {
		super(type, true);
		Checks.nonNull(value, "value");
		this.value = value;
	}

	public ScalarResponse(@Nonnull EntityType type) {
		super(type);
		value = null;
	}

	/**
	 * @throws IllegalStateException if this is not provided
	 */
	@Nonnull
	public T getValue() {
		checkProvided();
		return value;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy