예제 #1
0
 public void load() throws BackingStoreException {
   options.clear();
   for (final CompilerOption option : CompilerOption.ALL_OPTIONS) {
     final String value = helper.getString(option.getName(), null);
     if (option instanceof BooleanOption) {
       options.put(
           option,
           value != null
               ? Boolean.parseBoolean(value)
               : ((BooleanOption) option).getDefaultValue());
     } else if (option instanceof PathsOption) {
       if (!Strings.isNullOrEmpty(value)) {
         options.put(option, PathsOption.fromString(value));
       }
     } else if (option instanceof ModuleOption) {
       if (!Strings.isNullOrEmpty(value)) {
         options.put(option, value);
       }
     } else {
       if (value != null) {
         // final String[] str = value.split(SEPARATOR);
         // options.put(option, new Tuple<String, String>(str[0],
         // str[1]));
       }
     }
   }
   options.put(CompilerOption.DEBUG_INFO, true);
 }
예제 #2
0
 public void store() throws BackingStoreException {
   for (final CompilerOption option : CompilerOption.ALL_OPTIONS) {
     final Object value = options.get(option);
     if (option instanceof BooleanOption) {
       final Boolean val = (Boolean) value;
       helper.putString(option.getName(), val.toString());
     } else if (option instanceof PathsOption) {
       if (value != null) {
         @SuppressWarnings("unchecked")
         final Iterable<String> avalue = (Iterable<String>) value;
         helper.putString(option.getName(), PathsOption.toString(avalue));
       } else {
         helper.remove(option.getName());
       }
     } else if (option instanceof ModuleOption) {
       if (value != null) {
         final String avalue = (String) value;
         helper.putString(option.getName(), avalue);
       } else {
         helper.remove(option.getName());
       }
     } else {
       if (value != null) {
         @SuppressWarnings("unchecked")
         final Collection<Tuple<String, String>> val = (Collection<Tuple<String, String>>) value;
         helper.putString(option.getName(), val.toString());
       } else {
         helper.remove(option.getName());
       }
     }
   }
   helper.flush();
 }