Package org.waveprotocol.wave.util.settings

Examples of org.waveprotocol.wave.util.settings.Setting


    // Filter only annotated fields
    Map<Setting, Field> settings = new HashMap<Setting, Field>();

    for (Field f : coreSettingFields) {
      if (f.isAnnotationPresent(Setting.class)) {
        Setting setting = f.getAnnotation(Setting.class);
        settings.put(setting, f);
      }
    }

    return settings;
View Full Code Here


        // We must iterate the settings when binding.
        // Note: do not collapse these loops as that will damage
        // early error detection. The runtime is still O(n) in setting count.
        for (Map.Entry<Setting, Field> entry : coreSettings.entrySet()) {

          Setting setting = entry.getKey();
          Class<?> type = entry.getValue().getType();
          String value =
              propertyMap.containsKey(setting.name()) ? propertyMap.get(setting.name()) : setting
                  .defaultValue();
          if (int.class.equals(type)) {
            // Integer defaultValue = null;
            // if (!setting.defaultValue().isEmpty()) {
            // defaultValue = Integer.parseInt(setting.defaultValue());
            // }
            bindConstant().annotatedWith(Names.named(setting.name())).to(Integer.parseInt(value));
          } else if (boolean.class.equals(type)) {
            // Boolean defaultValue = null;
            // if (!setting.defaultValue().isEmpty()) {
            // defaultValue = Boolean.parseBoolean(setting.defaultValue());
            // }
            bindConstant().annotatedWith(Names.named(setting.name())).to(
                Boolean.parseBoolean(value));
          } else if (String.class.equals(type)) {
            bindConstant().annotatedWith(Names.named(setting.name())).to(value);
          } else {
            /** Not supported **/
            /*
             * String[] value = config.getStringArray(setting.name()); if
             * (value.length == 0 && !setting.defaultValue().isEmpty()) { value
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.util.settings.Setting

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.