Example #1
0
  /**
   * Use this in place of valueOf.
   *
   * @param value real value
   * @return SubscriptionType corresponding to the value
   */
  public static SubscriptionType fromValue(String value) {
    if (value == null || "".equals(value)) {
      throw new IllegalArgumentException("Value cannot be null or empty!");
    }

    for (SubscriptionType enumEntry : SubscriptionType.values()) {
      if (enumEntry.toString().equals(value)) {
        return enumEntry;
      }
    }

    throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
  }
Example #2
0
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((subjectId == null) ? 0 : subjectId.hashCode());
   result = prime * result + ((subscriptionType == null) ? 0 : subscriptionType.hashCode());
   result = prime * result + ((userName == null) ? 0 : userName.hashCode());
   return result;
 }