All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.maven.doxia.site.MenuItem Maven / Gradle / Ivy

The newest version!
/*
 =================== DO NOT EDIT THIS FILE ====================
 
 Generated by Modello 2.4.0,
 
 any modifications will be overwritten.
 
 ==============================================================
 */

package org.apache.maven.doxia.site;

/**
 * A menu item.
 * 
 * @version $Revision$ $Date$
 */
@SuppressWarnings( "all" )
public class MenuItem
    extends LinkItem
    implements java.io.Serializable, java.lang.Cloneable
{

      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * Whether to collapse children elements of an item menu (by
     * default).
     */
    private boolean collapse = false;

    /**
     * A reference to a pre-defined menu item, such as a report
     * (specified by the report goal
     *             name). Any elements explicitly given override
     * those from the pre-defined reference.
     */
    private String ref;

    /**
     * Field items.
     */
    private java.util.List items;


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * Method addItem.
     * 
     * @param menuItem a menuItem object.
     */
    public void addItem( MenuItem menuItem )
    {
        getItems().add( menuItem );
    } //-- void addItem( MenuItem )

    /**
     * Method clone.
     * 
     * @return MenuItem
     */
    public MenuItem clone()
    {
        try
        {
            MenuItem copy = (MenuItem) super.clone();

            if ( this.items != null )
            {
                copy.items = new java.util.ArrayList();
                for ( MenuItem item : this.items )
                {
                    copy.items.add( ( (MenuItem) item).clone() );
                }
            }

            return copy;
        }
        catch ( java.lang.Exception ex )
        {
            throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
                + " does not support clone()" ).initCause( ex );
        }
    } //-- MenuItem clone()

    /**
     * Method equals.
     * 
     * @param other a other object.
     * @return boolean
     */
    public boolean equals( Object other )
    {
        if ( this == other )
        {
            return true;
        }

        if ( !( other instanceof MenuItem ) )
        {
            return false;
        }

        MenuItem that = (MenuItem) other;
        boolean result = true;

        result = result && collapse == that.collapse;
        result = result && ( getRef() == null ? that.getRef() == null : getRef().equals( that.getRef() ) );
        result = result && ( getItems() == null ? that.getItems() == null : getItems().equals( that.getItems() ) );
        result = result && ( super.equals( other ) );

        return result;
    } //-- boolean equals( Object )

    /**
     * Method getItems.
     * 
     * @return List
     */
    public java.util.List getItems()
    {
        if ( this.items == null )
        {
            this.items = new java.util.ArrayList();
        }

        return this.items;
    } //-- java.util.List getItems()

    /**
     * Get a reference to a pre-defined menu item, such as a report
     * (specified by the report goal
     *             name). Any elements explicitly given override
     * those from the pre-defined reference.
     * 
     * @return String
     */
    public String getRef()
    {
        return this.ref;
    } //-- String getRef()

    /**
     * Method hashCode.
     * 
     * @return int
     */
    public int hashCode()
    {
        int result = 17;

        result = 37 * result + ( collapse ? 0 : 1 );
        result = 37 * result + ( ref != null ? ref.hashCode() : 0 );
        result = 37 * result + ( items != null ? items.hashCode() : 0 );
        result = 37 * result + super.hashCode();

        return result;
    } //-- int hashCode()

    /**
     * Get whether to collapse children elements of an item menu
     * (by default).
     * 
     * @return boolean
     */
    public boolean isCollapse()
    {
        return this.collapse;
    } //-- boolean isCollapse()

    /**
     * Method removeItem.
     * 
     * @param menuItem a menuItem object.
     */
    public void removeItem( MenuItem menuItem )
    {
        getItems().remove( menuItem );
    } //-- void removeItem( MenuItem )

    /**
     * Set whether to collapse children elements of an item menu
     * (by default).
     * 
     * @param collapse a collapse object.
     */
    public void setCollapse( boolean collapse )
    {
        this.collapse = collapse;
    } //-- void setCollapse( boolean )

    /**
     * Set a list of menu item.
     * 
     * @param items a items object.
     */
    public void setItems( java.util.List items )
    {
        this.items = items;
    } //-- void setItems( java.util.List )

    /**
     * Set a reference to a pre-defined menu item, such as a report
     * (specified by the report goal
     *             name). Any elements explicitly given override
     * those from the pre-defined reference.
     * 
     * @param ref a ref object.
     */
    public void setRef( String ref )
    {
        this.ref = ref;
    } //-- void setRef( String )

    /**
     * Method toString.
     * 
     * @return String
     */
    public java.lang.String toString()
    {
        StringBuilder buf = new StringBuilder( 128 );

        buf.append( "collapse = '" );
        buf.append( isCollapse() );
        buf.append( "'" );
        buf.append( "\n" ); 
        buf.append( "ref = '" );
        buf.append( getRef() );
        buf.append( "'" );
        buf.append( "\n" ); 
        buf.append( "items = '" );
        buf.append( getItems() );
        buf.append( "'" );
        buf.append( "\n" );
        buf.append( super.toString() );

        return buf.toString();
    } //-- java.lang.String toString()

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy