- public Album setDescription(String description) {
- Validation.begin().isNotNull("Album Description", description).check();
- this.description = description;
- return this;
- }
-
- //
- // FINGERPRINTABLE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getFingerprint() {
- StringBuilder fingerprint = new StringBuilder();
- fingerprint.append("Album(");
- fingerprint.append("ID(").append(id).append(')');
- fingerprint.append("Name(").append(name).append(')');
- fingerprint.append("Description(").append(description).append(')');
-
- /* add nested albums. */
- fingerprint.append("Albums(");
- for (Album album : albums) {
- fingerprint.append(album.getFingerprint());
- }
- fingerprint.append(')');
-
- /* add images. */
- fingerprint.append("Images(");
- for (Image image : images) {
- fingerprint.append(image.getFingerprint());
- }
- fingerprint.append(')');
-
- fingerprint.append(')');
- return fingerprint.toString();
- }
-
- //
- // OBJECT METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object object) {
- if (!(object instanceof Album)) {
- return false;
- }
- Album album = (Album) object;
- return id.equals(album.id);
- }