MenuItem.java

package com.tradecloud.domain;

import javax.xml.bind.annotation.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * MenuItem.
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "MenuItem")
public class MenuItem implements Serializable {

    private static final long serialVersionUID = 1L;

    @XmlElement(name = "MenuItem")
    protected List<MenuItem> menuItems;
    @XmlAttribute(required = true)
    protected String label;
    @XmlAttribute
    protected String data;
    @XmlAttribute
    protected Boolean enabled;

    /**
     * Gets the value of the menuItem property.
     */
    public List<MenuItem> getMenuItems() {
        if (menuItems == null) {
            menuItems = new ArrayList<MenuItem>();
        }
        return this.menuItems;
    }

    /**
     * Gets the value of the label property.
     */
    public String getLabel() {
        return label;
    }

    /**
     * Sets the value of the label property.
     */
    public void setLabel(String value) {
        this.label = value;
    }

    /**
     * Gets the value of the data property.
     */
    public String getData() {
        return data;
    }

    /**
     * Sets the value of the data property.
     */
    public void setData(String value) {
        this.data = value;
    }

    /**
     * Gets the value of the enabled property.
     */
    public Boolean isEnabled() {
        return enabled;
    }

    /**
     * Sets the value of the enabled property.
     */
    public void setEnabled(Boolean value) {
        this.enabled = value;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((data == null) ? 0 : data.hashCode());
        result = prime * result + ((enabled == null) ? 0 : enabled.hashCode());
        result = prime * result + ((label == null) ? 0 : label.hashCode());
        result = prime * result + ((menuItems == null) ? 0 : menuItems.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        MenuItem other = (MenuItem) obj;
        if (data == null) {
            if (other.data != null)
                return false;
        } else if (!data.equals(other.data))
            return false;
        if (enabled == null) {
            if (other.enabled != null)
                return false;
        } else if (!enabled.equals(other.enabled))
            return false;
        if (label == null) {
            if (other.label != null)
                return false;
        } else if (!label.equals(other.label))
            return false;
        if (menuItems == null) {
            if (other.menuItems != null)
                return false;
        } else if (!menuItems.equals(other.menuItems))
            return false;
        return true;
    }

    @Override
    public String toString() {
        return "label='" + label + "', data='" + data + "', enabled='" + enabled + "'. " + (menuItems != null ? menuItems.toString() : "");
    }

}