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

org.apache.maven.model.PatternSet Maven / Gradle / Ivy

There is a newer version: 4.0.0-beta-5
Show newest version
// =================== DO NOT EDIT THIS FILE ====================
// Generated by Modello 2.1.2,
// any modifications will be overwritten.
// ==============================================================

package org.apache.maven.model;

/**
 * Definition of include or exclude patterns.
 * 
 * @version $Revision$ $Date$
 */
@SuppressWarnings( "all" )
public class PatternSet
    implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
{

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

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

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

    /**
     * Field locations.
     */
    private java.util.Map locations;

    /**
     * Field location.
     */
    private InputLocation location;

    /**
     * Field includesLocation.
     */
    private InputLocation includesLocation;

    /**
     * Field excludesLocation.
     */
    private InputLocation excludesLocation;


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

    /**
     * Method addExclude.
     * 
     * @param string a string object.
     */
    public void addExclude( String string )
    {
        getExcludes().add( string );
    } //-- void addExclude( String )

    /**
     * Method addInclude.
     * 
     * @param string a string object.
     */
    public void addInclude( String string )
    {
        getIncludes().add( string );
    } //-- void addInclude( String )

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

            if ( this.includes != null )
            {
                copy.includes = new java.util.ArrayList();
                copy.includes.addAll( this.includes );
            }

            if ( this.excludes != null )
            {
                copy.excludes = new java.util.ArrayList();
                copy.excludes.addAll( this.excludes );
            }

            if ( copy.locations != null )
            {
                copy.locations = new java.util.LinkedHashMap( copy.locations );
            }

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

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

        return this.excludes;
    } //-- java.util.List getExcludes()

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

        return this.includes;
    } //-- java.util.List getIncludes()

    /**
     * 
     * 
     * @param key a key object.
     * @return InputLocation
     */
    public InputLocation getLocation( Object key )
    {
        if ( key instanceof String )
        {
            switch ( ( String ) key )
            {
                case "" :
                {
                    return this.location;
                }
                case "includes" :
                {
                    return includesLocation;
                }
                case "excludes" :
                {
                    return excludesLocation;
                }
                default :
                {
                    return getOtherLocation( key );
                }
                }
            }
            else
            {
                return getOtherLocation( key );
            }
    } //-- InputLocation getLocation( Object )

    /**
     * 
     * 
     * @param key a key object.
     * @param location a location object.
     */
    public void setLocation( Object key, InputLocation location )
    {
        if ( key instanceof String )
        {
            switch ( ( String ) key )
            {
                case "" :
                {
                    this.location = location;
                    return;
                }
                case "includes" :
                {
                    includesLocation = location;
                    return;
                }
                case "excludes" :
                {
                    excludesLocation = location;
                    return;
                }
                default :
                {
                    setOtherLocation( key, location );
                    return;
                }
            }
        }
        else
        {
            setOtherLocation( key, location );
        }
    } //-- void setLocation( Object, InputLocation )

    /**
     * 
     * 
     * @param key a key object.
     * @param location a location object.
     */
    public void setOtherLocation( Object key, InputLocation location )
    {
        if ( location != null )
        {
            if ( this.locations == null )
            {
                this.locations = new java.util.LinkedHashMap();
            }
            this.locations.put( key, location );
        }
    } //-- void setOtherLocation( Object, InputLocation )

    /**
     * 
     * 
     * @param key a key object.
     * @return InputLocation
     */
    private InputLocation getOtherLocation( Object key )
    {
        return ( locations != null ) ? locations.get( key ) : null;
    } //-- InputLocation getOtherLocation( Object )

    /**
     * Method removeExclude.
     * 
     * @param string a string object.
     */
    public void removeExclude( String string )
    {
        getExcludes().remove( string );
    } //-- void removeExclude( String )

    /**
     * Method removeInclude.
     * 
     * @param string a string object.
     */
    public void removeInclude( String string )
    {
        getIncludes().remove( string );
    } //-- void removeInclude( String )

    /**
     * Set a list of patterns to exclude, e.g.
     * **/*.xml
     * 
     * @param excludes a excludes object.
     */
    public void setExcludes( java.util.List excludes )
    {
        this.excludes = excludes;
    } //-- void setExcludes( java.util.List )

    /**
     * Set a list of patterns to include, e.g.
     * **/*.xml.
     * 
     * @param includes a includes object.
     */
    public void setIncludes( java.util.List includes )
    {
        this.includes = includes;
    } //-- void setIncludes( java.util.List )

    
            
    /**
     * @see java.lang.Object#toString()
     */
    public String toString()
    {
        StringBuilder sb = new StringBuilder( 128 );

        sb.append("PatternSet [includes: {");
        for (java.util.Iterator i = getIncludes().iterator(); i.hasNext(); )
        {
            String str = (String) i.next();
            sb.append(str).append(", ");
        }
        if (sb.substring(sb.length() - 2).equals(", ")) sb.delete(sb.length() - 2, sb.length());

        sb.append("}, excludes: {");
        for (java.util.Iterator i = getExcludes().iterator(); i.hasNext(); )
        {
            String str = (String) i.next();
            sb.append(str).append(", ");
        }
        if (sb.substring(sb.length() - 2).equals(", ")) sb.delete(sb.length() - 2, sb.length());

        sb.append("}]");
        return sb.toString();
    }
            
          
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy