hydra.langs.avro.schema.Primitive Maven / Gradle / Ivy
package hydra.langs.avro.schema;
import java.io.Serializable;
public abstract class Primitive implements Serializable {
public static final hydra.core.Name NAME = new hydra.core.Name("hydra/langs/avro/schema.Primitive");
private Primitive () {
}
public abstract R accept(Visitor visitor) ;
public interface Visitor {
R visit(Null instance) ;
R visit(Boolean_ instance) ;
R visit(Int instance) ;
R visit(Long_ instance) ;
R visit(Float_ instance) ;
R visit(Double_ instance) ;
R visit(Bytes instance) ;
R visit(String_ instance) ;
}
public interface PartialVisitor extends Visitor {
default R otherwise(Primitive instance) {
throw new IllegalStateException("Non-exhaustive patterns when matching: " + (instance));
}
default R visit(Null instance) {
return otherwise((instance));
}
default R visit(Boolean_ instance) {
return otherwise((instance));
}
default R visit(Int instance) {
return otherwise((instance));
}
default R visit(Long_ instance) {
return otherwise((instance));
}
default R visit(Float_ instance) {
return otherwise((instance));
}
default R visit(Double_ instance) {
return otherwise((instance));
}
default R visit(Bytes instance) {
return otherwise((instance));
}
default R visit(String_ instance) {
return otherwise((instance));
}
}
/**
* no value
*/
public static final class Null extends hydra.langs.avro.schema.Primitive implements Serializable {
public Null () {
}
@Override
public boolean equals(Object other) {
if (!(other instanceof Null)) {
return false;
}
Null o = (Null) (other);
return true;
}
@Override
public int hashCode() {
return 0;
}
@Override
public R accept(Visitor visitor) {
return visitor.visit(this);
}
}
/**
* A binary value
*/
public static final class Boolean_ extends hydra.langs.avro.schema.Primitive implements Serializable {
public Boolean_ () {
}
@Override
public boolean equals(Object other) {
if (!(other instanceof Boolean_)) {
return false;
}
Boolean_ o = (Boolean_) (other);
return true;
}
@Override
public int hashCode() {
return 0;
}
@Override
public R accept(Visitor visitor) {
return visitor.visit(this);
}
}
/**
* 32-bit signed integer
*/
public static final class Int extends hydra.langs.avro.schema.Primitive implements Serializable {
public Int () {
}
@Override
public boolean equals(Object other) {
if (!(other instanceof Int)) {
return false;
}
Int o = (Int) (other);
return true;
}
@Override
public int hashCode() {
return 0;
}
@Override
public R accept(Visitor visitor) {
return visitor.visit(this);
}
}
/**
* 64-bit signed integer
*/
public static final class Long_ extends hydra.langs.avro.schema.Primitive implements Serializable {
public Long_ () {
}
@Override
public boolean equals(Object other) {
if (!(other instanceof Long_)) {
return false;
}
Long_ o = (Long_) (other);
return true;
}
@Override
public int hashCode() {
return 0;
}
@Override
public R accept(Visitor visitor) {
return visitor.visit(this);
}
}
/**
* single precision (32-bit) IEEE 754 floating-point number
*/
public static final class Float_ extends hydra.langs.avro.schema.Primitive implements Serializable {
public Float_ () {
}
@Override
public boolean equals(Object other) {
if (!(other instanceof Float_)) {
return false;
}
Float_ o = (Float_) (other);
return true;
}
@Override
public int hashCode() {
return 0;
}
@Override
public R accept(Visitor visitor) {
return visitor.visit(this);
}
}
/**
* double precision (64-bit) IEEE 754 floating-point number
*/
public static final class Double_ extends hydra.langs.avro.schema.Primitive implements Serializable {
public Double_ () {
}
@Override
public boolean equals(Object other) {
if (!(other instanceof Double_)) {
return false;
}
Double_ o = (Double_) (other);
return true;
}
@Override
public int hashCode() {
return 0;
}
@Override
public R accept(Visitor visitor) {
return visitor.visit(this);
}
}
/**
* sequence of 8-bit unsigned bytes
*/
public static final class Bytes extends hydra.langs.avro.schema.Primitive implements Serializable {
public Bytes () {
}
@Override
public boolean equals(Object other) {
if (!(other instanceof Bytes)) {
return false;
}
Bytes o = (Bytes) (other);
return true;
}
@Override
public int hashCode() {
return 0;
}
@Override
public R accept(Visitor visitor) {
return visitor.visit(this);
}
}
/**
* unicode character sequence
*/
public static final class String_ extends hydra.langs.avro.schema.Primitive implements Serializable {
public String_ () {
}
@Override
public boolean equals(Object other) {
if (!(other instanceof String_)) {
return false;
}
String_ o = (String_) (other);
return true;
}
@Override
public int hashCode() {
return 0;
}
@Override
public R accept(Visitor visitor) {
return visitor.visit(this);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy