ke.co.tawi.babblesms.server.beans.contact.Contact.java Source code

Java tutorial

Introduction

Here is the source code for ke.co.tawi.babblesms.server.beans.contact.Contact.java

Source

/**
 * Copyright 2015 Tawi Commercial Services Ltd
 * 
 * Licensed under the Open Software License, Version 3.0 (the License?); you may
 * not use this file except in compliance with the License. You may obtain a copy
 * of the License at:
 * http://opensource.org/licenses/OSL-3.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed
 * under the License is distributed on an AS IS? BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied.
 * 
 * See the License for the specific language governing permissions and limitations
 * under the License.
 */
package ke.co.tawi.babblesms.server.beans.contact;

import ke.co.tawi.babblesms.server.beans.StorableBean;

import org.apache.commons.lang3.StringUtils;

/**
 * A Contact within an Address Book.
 * <p>
 *  
 * @author <a href="mailto:michael@tawi.mobi">Michael Wakahe</a>
 */
public class Contact extends StorableBean implements Comparable<Contact> {

    private String name;
    private String description;
    private String accountUuid;
    private String statusUuid;

    /**
     * 
     */
    public Contact() {
        super();
        name = "";
        description = "";
        accountUuid = "";
        statusUuid = "";
    }

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

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

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = StringUtils.trimToEmpty(description);
    }

    /**
     * @return the accountUuid
     */
    public String getAccountUuid() {
        return accountUuid;
    }

    /**
     * @param accountUuid the accountUuid to set
     */
    public void setAccountUuid(String accountUuid) {
        this.accountUuid = StringUtils.trimToEmpty(accountUuid);
    }

    /**
     * @return the statusUuid
     */
    public String getStatusUuid() {
        return statusUuid;
    }

    /**
     * @param statusUuid the statusUuid to set
     */
    public void setStatusUuid(String statusUuid) {
        this.statusUuid = StringUtils.trimToEmpty(statusUuid);
    }

    /**
     * @see java.lang.Comparable#compareTo(java.lang.Object)
     */
    @Override
    public int compareTo(Contact c) {
        return name.compareTo(((Contact) c).getName());
    }

    /**
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("Contact [getUuid()=");
        builder.append(getUuid());
        builder.append(", name=");
        builder.append(name);
        builder.append(", description=");
        builder.append(description);
        builder.append(", accountUuid=");
        builder.append(accountUuid);
        builder.append(", statusUuid=");
        builder.append(statusUuid);
        builder.append("]");
        return builder.toString();
    }

}