View Javadoc

    1   /**
    2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
    3    */
    4   package net.sourceforge.pmd.lang;
    5
    6   /**
    7    * Represents a set of configuration options for a {@link Parser}.  For each
    8    * unique combination of ParserOptions a Parser will be used to create an AST.
    9    * Therefore, implementations must implement {@link Object#equals(Object)}
    10   * and {@link Object#hashCode()}.
    11   */
    12  public class ParserOptions {
    13      protected String suppressMarker;
    14
    15      public String getSuppressMarker() {
    16  	return suppressMarker;
    17      }
    18
    19      public void setSuppressMarker(String suppressMarker) {
    20  	this.suppressMarker = suppressMarker;
    21      }
    22
    23      @Override
    24      public boolean equals(Object obj) {
    25  	if (this == obj) {
    26  	    return true;
    27  	}
    28  	if (obj == null || getClass() != obj.getClass()) {
    29  	    return false;
    30  	}
    31  	final ParserOptions that = (ParserOptions) obj;
    32  	return this.suppressMarker.equals(that.suppressMarker);
    33      }
    34
    35      @Override
    36      public int hashCode() {
    37  	return suppressMarker != null ? suppressMarker.hashCode() : 0;
    38      }
    39  }