org.intermine.api.beans.ObjectDetails.java Source code

Java tutorial

Introduction

Here is the source code for org.intermine.api.beans.ObjectDetails.java

Source

package org.intermine.api.beans;

/*
 * Copyright (C) 2002-2016 FlyMine
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  See the LICENSE file for more
 * information or http://www.gnu.org/copyleft/lesser.html.
 *
 */
import java.io.Serializable;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

/**
 * An object that describes an object.
 * @author alex
 *
 */
public class ObjectDetails implements Serializable {

    private String name, identifier, type;

    /**
     * @return the identifier
     */
    public String getIdentifier() {
        return identifier;
    }

    /**
     * @param identifier the identifier to set
     */
    public void setIdentifier(String identifier) {
        this.identifier = identifier;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the type
     */
    public String getType() {
        return type;
    }

    /**
     * @param type the type to set
     */
    public void setType(String type) {
        this.type = type;
    }

    // -- Object contract

    @Override
    public String toString() {
        return String.format("ObjectDetails(type = %s, identifier = %s, name = %s)", type, identifier, name);
    }

    @Override
    public int hashCode() {
        HashCodeBuilder hcb = new HashCodeBuilder();
        hcb.append(type).append(identifier).append(name);
        return hcb.toHashCode();
    }

    @Override
    public boolean equals(Object other) {
        if (other == null) {
            return false;
        }
        if (other == this) {
            return true;
        }
        if (other.getClass() != getClass()) {
            return false;
        }
        ObjectDetails rhs = (ObjectDetails) other;
        return new EqualsBuilder().append(type, rhs.type).append(identifier, rhs.identifier).append(name, rhs.name)
                .isEquals();
    }

}