Credential.java

// license-header java merge-point
//
// Attention: Generated code! Do not modify by hand!
// Generated by EmbeddedValue.vsl in andromda-ejb3-cartridge on 08/08/2014 12:21:07.
//
package org.andromda.demo.ejb3.customer;

import java.io.Serializable;
import javax.persistence.Column;

/**
 * <p>
 * TODO: Model Documentation for org.andromda.demo.ejb3.customer.Credential
 * </p>
 *
 * Migrated from using @javax.persistence.Embeddable annotation to mapping in orm.xml
 * Still use the attribute annotations
 */
public abstract class Credential
    implements Serializable
{
    /**
     * The serial version UID of this class. Needed for serialization.
     */
    private static final long serialVersionUID = -2672027464726873527L;

    /**
     * Creates a new instance of {@link Credential}
     * taking all properties.
     * @param name
     * @param mobileNumber
     */
    public static Credential newInstance(String name, String mobileNumber)
    {
        CredentialImpl object = new CredentialImpl();
        object.setName(name);
        object.setMobileNumber(mobileNumber);
        object.initialize();
        return object;
    }

    /**
     * Creates a new instance from other Credential instance.
     * @param otherObject
     * @return Credential
     */
    public static Credential newInstance(Credential otherObject)
    {
        if (otherObject != null)
        {
            return newInstance(otherObject.getName(),otherObject.getMobileNumber());
        }
        return null;
    }

    /**
     * Constructor does nothing
     */
    protected Credential()
    {
        // Constructor does nothing
    }

    /**
     * Hook for initializing the object in the subclass
     */
    protected void initialize()
    {
        // Empty initialization
    }

    private String name;

    /**
     * <p>
     * TODO: Model Documentation for name
     * </p>
     * @return String
     */
    @Column(name = "NAME", nullable = false, insertable = true, updatable = true, length = 64)
    public String getName()
    {
        return this.name;
    }

    /**
     * <p>
     * TODO: Model Documentation for org.andromda.demo.ejb3.customer.Credential
     * </p>
     * @param nameIn
     */
    public void setName(String nameIn)
    {
        this.name = nameIn;
    }

    private String mobileNumber;

    /**
     * <p>
     * TODO: Model Documentation for mobileNumber
     * </p>
     * @return String
     */
    @Column(name = "MOBILE_NUMBER", insertable = true, updatable = true, length = 14)
    public String getMobileNumber()
    {
        return this.mobileNumber;
    }

    /**
     * <p>
     * TODO: Model Documentation for org.andromda.demo.ejb3.customer.Credential
     * </p>
     * @param mobileNumberIn
     */
    public void setMobileNumber(String mobileNumberIn)
    {
        this.mobileNumber = mobileNumberIn;
    }

    /**
     * Indicates if the argument is of the same type and all values are equal.
     */
    /**
     * Indicates if the argument is of the same type and all values are equal.
     * @param object The target object to compare with
     * @return boolean True if both objects a 'equal'
     * @see Object#equals(Object)
     */
    @Override
    public boolean equals(Object object)
    {
        if (null == object)
        {
            return false;
        }
        if (this == object)
        {
            return true;
        }
        if (!(object instanceof Credential))
        {
            return false;
        }
        final Credential that = (Credential)object;
        if (this.getName() == null || that.getName() == null || !this.getName().equals(that.getName()))
        {
            return false;
        }
        if (this.getMobileNumber() == null || that.getMobileNumber() == null || !this.getMobileNumber().equals(that.getMobileNumber()))
        {
            return false;
        }
        return true;
    }


    /**
     * Returns a hash code value for the object
     * @return int The hash code value
     * @see Object#hashCode
     */
    @Override
    public int hashCode()
    {
        int hashCode = 0;
        hashCode = 29 * hashCode + (getName() == null ? 0 : getName().hashCode());
        hashCode = 29 * hashCode + (getMobileNumber() == null ? 0 : getMobileNumber().hashCode());

        return hashCode;
    }


    /**
     * Returns a String representation of the object
     *
     * @return String Textual representation of the object displaying name/value pairs for all attributes
     */
    /**
     * Returns a String representation of the object
     * @return String Textual representation of the object displaying name/value pairs for all attributes
     * @see Object#toString
     */
    @Override
    public String toString()
    {
        StringBuilder sb = new StringBuilder();
        sb.append("Credential(");
        sb.append(" name=").append(getName());
        sb.append(" mobileNumber=").append(getMobileNumber());
        sb.append(")");
        return sb.toString();
    }

}