package net.pterodactylus.xdcc.data;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* A pack is a downloadable file offered by a {@link Bot}.
*
* The name of the pack
*/
public Pack(String id, String size, String name) {
- this.id = id;
- this.size = size;
- this.name = name;
+ this.id = checkNotNull(id, "id must not be null");
+ this.size = checkNotNull(size, "size must not be null");
+ this.name = checkNotNull(name, "name must not be null");
}
//
return name;
}
+ //
+ // OBJECT METHODS
+ //
+
+ @Override
+ public boolean equals(Object object) {
+ if (!(object instanceof Pack)) {
+ return false;
+ }
+ Pack pack = (Pack) object;
+ return id().equals(pack.id()) && name().equals(pack.name());
+ }
+
+ @Override
+ public int hashCode() {
+ return id().hashCode() ^ name().hashCode();
+ }
+
}