001    package org.andromda.core.configuration;
002    
003    import java.io.Serializable;
004    import org.apache.commons.lang.StringUtils;
005    import org.apache.commons.lang.builder.ToStringBuilder;
006    
007    /**
008     * This class represents properties which are used to configure Namespace objects which are made available to configure
009     * Plugin instances.
010     *
011     * @author Chad Brandon
012     * @see org.andromda.core.configuration.Namespace
013     * @see org.andromda.core.configuration.Namespaces
014     */
015    public class Property
016        implements Serializable
017    {
018        private static final long serialVersionUID = 34L;
019    
020        /**
021         * The property name.
022         */
023        private String name;
024    
025        /**
026         * Returns the name. This is used by Namespaces to find this property.
027         *
028         * @return String
029         */
030        public String getName()
031        {
032            return name;
033        }
034    
035        /**
036         * Sets the name.
037         *
038         * @param name The name to set
039         */
040        public void setName(final String name)
041        {
042            this.name = StringUtils.trimToEmpty(name);
043        }
044    
045        /**
046         * The property value.
047         */
048        private String value;
049    
050        /**
051         * Returns the value. This is the value that is stored in this property.
052         *
053         * @return the value as a String
054         */
055        public String getValue()
056        {
057            return value;
058        }
059    
060        /**
061         * Sets the value.
062         *
063         * @param value The value to set
064         */
065        public void setValue(final String value)
066        {
067            this.value = StringUtils.trimToEmpty(value);
068        }
069    
070        /**
071         * Stores whether or not this property should be ignored.
072         */
073        private boolean ignore = false;
074    
075        /**
076         * If a property is set to ignore then Namespaces will ignore it if it doesn't exist on lookup (otherwise errors
077         * messages are output). This is useful if you have a plugin on a classpath (its unavoidable), but you don't want to
078         * see the errors messages (since it really isn't an error). Another use of it would be to ignore outlet entires for
079         * cartridges if you wanted to generate some from the cartridge outlets, but not others.
080         *
081         * @return Returns the ignore value true/false.
082         */
083        public boolean isIgnore()
084        {
085            return ignore;
086        }
087    
088        /**
089         * @param ignore The ignore to set.
090         * @see #isIgnore()
091         */
092        public void setIgnore(final boolean ignore)
093        {
094            this.ignore = ignore;
095        }
096    
097        /**
098         * @see Object#toString()
099         */
100        public String toString()
101        {
102            return ToStringBuilder.reflectionToString(this);
103        }
104    }