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

com.sinch.sdk.core.utils.EnumDynamic Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
package com.sinch.sdk.core.utils;

/**
 * Abstract class providing common definition to extendable enums
 *
 * @param  Type of value
 * @param  Enum type
 */
public abstract class EnumDynamic> {

  private final T value;

  protected EnumDynamic(T value) {
    this.value = value;
  }

  /**
   * Get enum value as String
   *
   * @return Enum value
   */
  public T value() {
    return value;
  }

  @Override
  public String toString() {
    return value().toString();
  }

  @Override
  public boolean equals(Object o) {
    if (o == this) {
      return true;
    }
    if (!(o instanceof EnumDynamic)) {
      return false;
    }

    return java.util.Objects.equals(this.value, ((EnumDynamic) o).value());
  }

  @Override
  public int hashCode() {
    return value.hashCode();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy