com.mercateo.eventstore.domain.EventVersion Maven / Gradle / Ivy
Show all versions of client-common Show documentation
package com.mercateo.eventstore.domain;
import java.util.Objects;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
/**
* Immutable implementation of {@link _EventVersion}.
*
* Use the static factory method to create immutable instances:
* {@code EventVersion.of()}.
*/
@SuppressWarnings({"all"})
@ParametersAreNonnullByDefault
@Generated({"Immutables.generator", "_EventVersion"})
@Immutable
public final class EventVersion extends com.mercateo.eventstore.domain._EventVersion {
private final Integer value;
private EventVersion(Integer value) {
this.value = Objects.requireNonNull(value, "value");
}
/**
* @return The value of the {@code value} attribute
*/
@Override
public Integer value() {
return value;
}
/**
* This instance is equal to all instances of {@code EventVersion} that have equal attribute values.
* @return {@code true} if {@code this} is equal to {@code another} instance
*/
@Override
public boolean equals(@Nullable Object another) {
if (this == another) return true;
return another instanceof EventVersion
&& equalTo((EventVersion) another);
}
private boolean equalTo(EventVersion another) {
return value.equals(another.value);
}
/**
* Computes a hash code from attributes: {@code value}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 5381;
h += (h << 5) + value.hashCode();
return h;
}
/**
* Construct a new immutable {@code EventVersion} instance.
* @param value The value for the {@code value} attribute
* @return An immutable EventVersion instance
*/
public static EventVersion of(Integer value) {
return new EventVersion(value);
}
}