View Javadoc

    1   package net.sourceforge.pmd.lang.ast;
    2
    3   import java.util.HashMap;
    4   import java.util.Map;
    5
    6   import net.sourceforge.pmd.PMD;
    7
    8   public abstract class AbstractTokenManager {
    9
    10      // Because the TokenMgrError class does not have access to the TokenManager instance, we
    11      // cannot store the file name as an instance field, but must use a static.
    12      private static ThreadLocal<String> fileName = new ThreadLocal<String>();
    13
    14      protected Map<Integer, String> suppressMap = new HashMap<Integer, String>();
    15      protected String suppressMarker = PMD.SUPPRESS_MARKER;
    16
    17      public static void setFileName(String fileName) {
    18  	AbstractTokenManager.fileName.set(fileName);
    19      }
    20
    21      public static String getFileName() {
    22  	String fileName = AbstractTokenManager.fileName.get();
    23  	return fileName == null ? "(no file name provided)" : fileName;
    24      }
    25
    26      public void setSuppressMarker(String marker) {
    27  	this.suppressMarker = marker;
    28      }
    29
    30      public Map<Integer, String> getSuppressMap() {
    31  	return suppressMap;
    32      }
    33  }