1 61 62 package org.apache.commons.betwixt; 63 64 68 public class Category { 69 70 private String name; 71 72 public Category() {} 73 74 public Category(String name) { 75 setName(name); 76 } 77 78 public String getName() { 79 return name; 80 } 81 82 public void setName(String name) { 83 this.name = name; 84 } 85 86 public int hashCode() { 87 return 0; 88 } 89 90 public boolean equals(Object obj) { 91 boolean result = false; 92 93 if (obj instanceof Category) { 94 Category category = (Category) obj; 95 result = isEqual(name, category.name); 96 } 97 98 return result; 99 } 100 101 private boolean isEqual(String one, String two) { 102 if (one == null) { 103 return two == null; 104 } 105 106 return one.equals(two); 107 } 108 } 109 | Popular Tags |