Motocycle.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.Motocycle
 * </p>
 *
 * Autogenerated POJO EJB class for Motocycle containing the
 * bulk of the entity implementation.
 *
 * This is autogenerated by AndroMDA using the EJB3
 * cartridge.
 *
 * DO NOT MODIFY this class.
 */
@Entity
@DiscriminatorValue("MC")
@NamedQuery(name="Motocycle.findAll", query="SELECT m FROM Motocycle AS m")
public class Motocycle
    extends Vehicle
    implements Serializable{
    private static final long serialVersionUID = -7338239830953974857L;

    // ----------- 1 Attribute Definitions ------------
    protected String classCode;

    // -------- 1 Attribute Accessors ----------
    /**
     * <p>
     * TODO: Model Documentation for classCode
     * </p>
     * Get the classCode property.
     * @return String The value of classCode
     */
    @Column(name="CLASS_CODE", insertable=true, updatable=true, length=20)
    @Size(max=20)
    public String getClassCode()
    {
        return this.classCode;
    }

    /**
     * <p>
     * TODO: Model Documentation for classCode
     * </p>
     * Set the classCode property.
     * @param value the new value
     */
    public void setClassCode(String value)
    {
        this.classCode = value;
    }


    // ------------- 0 Relations ------------------
    // --------------- Constructors -----------------

    /**
     * Default empty no-arg constructor
     */
    public Motocycle()
    {
        // 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 classCode String value for the classCode property required=false lower=1
     */
    public Motocycle(String license, String make, String model, String classCode)
    {
        this.license = license;
        this.make = make;
        this.model = model;
        this.classCode = classCode;
    }

    /**
     * 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 Motocycle(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 Motocycle))
        {
            return false;
        }
        final Motocycle that = (Motocycle)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("Motocycle(");
        sb.append(super.toString());
        sb.append(" classCode=").append(getClassCode());
        sb.append(" license=").append(getLicense());
        sb.append(" make=").append(getMake());
        sb.append(" model=").append(getModel());
        sb.append(")");
        return sb.toString();
    }


}