Car.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.vehicle;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.NamedQuery;
import javax.validation.constraints.Size;
/**
* <p>
* TODO: Model Documentation for org.andromda.demo.ejb3.vehicle.Car
* </p>
*
* Autogenerated POJO EJB class for Car containing the
* bulk of the entity implementation.
*
* This is autogenerated by AndroMDA using the EJB3
* cartridge.
*
* DO NOT MODIFY this class.
*/
@Entity
@DiscriminatorValue("C")
@NamedQuery(name="Car.findAll", query="SELECT c FROM Car AS c")
public class Car
extends Vehicle
implements Serializable{
private static final long serialVersionUID = 2276574081632793253L;
// ----------- 2 Attribute Definitions ------------
protected String diffType;
protected int numDoors;
// -------- 2 Attribute Accessors ----------
/**
* <p>
* TODO: Model Documentation for diffType
* </p>
* Get the diffType property.
* @return String The value of diffType
*/
@Column(name="DIFF_TYPE", insertable=true, updatable=true, length=20)
@Size(max=20)
public String getDiffType()
{
return this.diffType;
}
/**
* <p>
* TODO: Model Documentation for diffType
* </p>
* Set the diffType property.
* @param value the new value
*/
public void setDiffType(String value)
{
this.diffType = value;
}
/**
* <p>
* TODO: Model Documentation for numDoors
* </p>
* Get the numDoors property.
* @return int The value of numDoors
*/
@Column(name="NUM_DOORS", insertable=true, updatable=true)
public int getNumDoors()
{
return this.numDoors;
}
/**
* <p>
* TODO: Model Documentation for numDoors
* </p>
* Set the numDoors property.
* @param value the new value
*/
public void setNumDoors(int value)
{
this.numDoors = value;
}
// ------------- 0 Relations ------------------
// --------------- Constructors -----------------
/**
* Default empty no-arg constructor
*/
public Car()
{
// Default empty constructor
}
/**
* Constructor with all updatable Entity attributes except auto incremented identifiers.
*
* @param license String value for the license property required=true lower=1
* @param make String value for the make property required=true lower=1
* @param model String value for the model property required=true lower=1
* @param diffType String value for the diffType property required=false lower=1
* @param numDoors int value for the numDoors property required=false lower=1
*/
public Car(String license, String make, String model, String diffType, int numDoors)
{
this.license = license;
this.make = make;
this.model = model;
this.diffType = diffType;
this.numDoors = numDoors;
}
/**
* Constructor with required Entity attributes except auto incremented identifiers.
*
* @param license Value for the license property
* @param make Value for the make property
* @param model Value for the model property
*/
public Car(String license, String make, String model)
{
this.license = license;
this.make = make;
this.model = model;
}
// -------- 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 Car))
{
return false;
}
final Car that = (Car)object;
if (this.getLicense() == null || that.getLicense() == null || !this.getLicense().equals(that.getLicense()))
{
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 = super.hashCode();
hashCode = 29 * hashCode + (getLicense() == null ? 0 : getLicense().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("Car(");
sb.append(super.toString());
sb.append(" diffType=").append(getDiffType());
sb.append(" numDoors=").append(getNumDoors());
sb.append(" license=").append(getLicense());
sb.append(" make=").append(getMake());
sb.append(" model=").append(getModel());
sb.append(")");
return sb.toString();
}
}