AnimalEmbeddable.java
// license-header java merge-point
//
// Attention: Generated code! Do not modify by hand!
// Generated by EntityEmbeddable.vsl in andromda-ejb3-cartridge on 08/08/2014 12:21:03.
//
package org.andromda.demo.ejb3.animal;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* <p>
* TODO: Model Documentation for org.andromda.demo.ejb3.animal.Animal
* </p>
*
* Autogenerated POJO EJB mapped super class for Animal containing the
* bulk of the entity implementation.
*
* This is a mapped super class and autogenerated by AndroMDA using the EJB3
* cartridge.
*
* DO NOT MODIFY this class.
*/
@MappedSuperclass
public abstract class AnimalEmbeddable
implements Serializable{
private static final long serialVersionUID = -4363106082863672597L;
// ----------- 3 Attribute Definitions ------------
protected String name;
protected Collection<String> types;
protected boolean carnivor;
// -------- 3 Attribute Accessors ----------
/**
* <p>
* TODO: Model Documentation for name
* </p>
* Get the name property.
* @return String The value of name
*/
@Id
@Column(name="NAME", nullable=false, insertable=true, updatable=true, length=50)
@NotNull(message="name is required")
@Size(max=50)
public String getName()
{
return this.name;
}
/**
* <p>
* TODO: Model Documentation for name
* </p>
* Set the name property.
* @param value the new value
*/
public void setName(String value)
{
this.name = value;
}
/**
* <p>
* TODO: Model Documentation for types
* </p>
* Get the types property.
* @return Collection<String> The value of types
*/
@Column(name="TYPES", insertable=true, updatable=true)
public Collection<String> getTypes()
{
return this.types;
}
/**
* <p>
* TODO: Model Documentation for types
* </p>
* Set the types property.
* @param value the new value
*/
public void setTypes(Collection<String> value)
{
this.types = value;
}
/**
* <p>
* TODO: Model Documentation for carnivor
* </p>
* Get the carnivor property.
* @return boolean The value of carnivor
*/
@Column(name="CARNIVOR", nullable=false, insertable=true, updatable=true)
@NotNull(message="carnivor is required")
public boolean isCarnivor()
{
return this.carnivor;
}
/**
* <p>
* TODO: Model Documentation for carnivor
* </p>
* Set the carnivor property.
* @param value the new value
*/
public void setCarnivor(boolean value)
{
this.carnivor = value;
}
// ------------- 0 Relations ------------------
// --------------- Constructors -----------------
/**
* Default empty no-arg constructor
*/
public AnimalEmbeddable()
{
// Default empty constructor
}
/**
* Constructor with all updatable Entity attributes except auto incremented identifiers.
*
* @param name String value for the name property required=true lower=1
* @param types Collection<String> value for the types property required=false lower=0
* @param carnivor boolean value for the carnivor property required=true lower=1
*/
public AnimalEmbeddable(String name, Collection<String> types, boolean carnivor)
{
this.name = name;
this.types = types;
this.carnivor = carnivor;
}
/**
* Constructor with required Entity attributes except auto incremented identifiers.
*
* @param name Value for the name property
* @param carnivor Value for the carnivor property
*/
public AnimalEmbeddable(String name, boolean carnivor)
{
this.name = name;
this.carnivor = carnivor;
}
// -------- Common Methods -----------
/**
* 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 AnimalEmbeddable))
{
return false;
}
final AnimalEmbeddable that = (AnimalEmbeddable)object;
if (this.getName() == null || that.getName() == null || !this.getName().equals(that.getName()))
{
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());
return hashCode;
}
/**
* 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("AnimalEmbeddable(");
sb.append(" name=").append(getName());
sb.append(" types=").append(getTypes());
sb.append(" carnivor=").append(isCarnivor());
sb.append(")");
return sb.toString();
}
}