Contact.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.Contact
* </p>
*
* Migrated from using @javax.persistence.Embeddable annotation to mapping in orm.xml
* Still use the attribute annotations
*/
public abstract class Contact
implements Serializable
{
/**
* The serial version UID of this class. Needed for serialization.
*/
private static final long serialVersionUID = 1908917208978718617L;
/**
* Creates a new instance of {@link Contact}
* taking all properties.
* @param firstname
* @param surname
*/
public static Contact newInstance(String firstname, String surname)
{
ContactImpl object = new ContactImpl();
object.setFirstname(firstname);
object.setSurname(surname);
object.initialize();
return object;
}
/**
* Creates a new instance from other Contact instance.
* @param otherObject
* @return Contact
*/
public static Contact newInstance(Contact otherObject)
{
if (otherObject != null)
{
return newInstance(otherObject.getFirstname(),otherObject.getSurname());
}
return null;
}
/**
* Constructor does nothing
*/
protected Contact()
{
// Constructor does nothing
}
/**
* Hook for initializing the object in the subclass
*/
protected void initialize()
{
// Empty initialization
}
private String firstname;
/**
* <p>
* TODO: Model Documentation for firstname
* </p>
* @return String
*/
@Column(name = "FIRSTNAME", nullable = false, insertable = true, updatable = true, length = 64)
public String getFirstname()
{
return this.firstname;
}
/**
* <p>
* TODO: Model Documentation for org.andromda.demo.ejb3.customer.Contact
* </p>
* @param firstnameIn
*/
public void setFirstname(String firstnameIn)
{
this.firstname = firstnameIn;
}
private String surname;
/**
* <p>
* TODO: Model Documentation for surname
* </p>
* @return String
*/
@Column(name = "SURNAME", nullable = false, insertable = true, updatable = true, length = 64)
public String getSurname()
{
return this.surname;
}
/**
* <p>
* TODO: Model Documentation for org.andromda.demo.ejb3.customer.Contact
* </p>
* @param surnameIn
*/
public void setSurname(String surnameIn)
{
this.surname = surnameIn;
}
/**
* 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 Contact))
{
return false;
}
final Contact that = (Contact)object;
if (this.getFirstname() == null || that.getFirstname() == null || !this.getFirstname().equals(that.getFirstname()))
{
return false;
}
if (this.getSurname() == null || that.getSurname() == null || !this.getSurname().equals(that.getSurname()))
{
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 + (getFirstname() == null ? 0 : getFirstname().hashCode());
hashCode = 29 * hashCode + (getSurname() == null ? 0 : getSurname().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("Contact(");
sb.append(" firstname=").append(getFirstname());
sb.append(" surname=").append(getSurname());
sb.append(")");
return sb.toString();
}
}