< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/util/Options.java

Print this page




  39  *  This code and its internal interfaces are subject to change or
  40  *  deletion without notice.</b>
  41  */
  42 public class Options {
  43     private static final long serialVersionUID = 0;
  44 
  45     /** The context key for the options. */
  46     public static final Context.Key<Options> optionsKey = new Context.Key<>();
  47 
  48     private LinkedHashMap<String,String> values;
  49 
  50     /** Get the Options instance for this context. */
  51     public static Options instance(Context context) {
  52         Options instance = context.get(optionsKey);
  53         if (instance == null)
  54             instance = new Options(context);
  55         return instance;
  56     }
  57 
  58     protected Options(Context context) {
  59 // DEBUGGING -- Use LinkedHashMap for reproducability
  60         values = new LinkedHashMap<>();
  61         context.put(optionsKey, this);
  62     }
  63 
  64     /**
  65      * Get the value for an undocumented option.
  66      */
  67     public String get(String name) {
  68         return values.get(name);
  69     }
  70 
  71     /**
  72      * Get the value for an option.
  73      */
  74     public String get(Option option) {
  75         return values.get(option.primaryName);
  76     }
  77 
  78     /**
  79      * Get the boolean value for an option, patterned after Boolean.getBoolean,




  39  *  This code and its internal interfaces are subject to change or
  40  *  deletion without notice.</b>
  41  */
  42 public class Options {
  43     private static final long serialVersionUID = 0;
  44 
  45     /** The context key for the options. */
  46     public static final Context.Key<Options> optionsKey = new Context.Key<>();
  47 
  48     private LinkedHashMap<String,String> values;
  49 
  50     /** Get the Options instance for this context. */
  51     public static Options instance(Context context) {
  52         Options instance = context.get(optionsKey);
  53         if (instance == null)
  54             instance = new Options(context);
  55         return instance;
  56     }
  57 
  58     protected Options(Context context) {
  59 // DEBUGGING -- Use LinkedHashMap for reproducibility
  60         values = new LinkedHashMap<>();
  61         context.put(optionsKey, this);
  62     }
  63 
  64     /**
  65      * Get the value for an undocumented option.
  66      */
  67     public String get(String name) {
  68         return values.get(name);
  69     }
  70 
  71     /**
  72      * Get the value for an option.
  73      */
  74     public String get(Option option) {
  75         return values.get(option.primaryName);
  76     }
  77 
  78     /**
  79      * Get the boolean value for an option, patterned after Boolean.getBoolean,


< prev index next >