Package com.complexible.common.util

Examples of com.complexible.common.util.EnhancedProperties


  /**
   * @inheritDoc
   */
  public EmpireConfiguration read(Reader theReader) throws IOException {
    Properties aProps = new EnhancedProperties();

    try {
      aProps.load(theReader);
    }
    catch (Exception e) {
      throw new IOException(e);
    }

    int aIndex = 0;

    Map<String, String> aGeneralConfig = new HashMap<String, String>();
    Map<String, Map<String, String>> aUnitConfig = new HashMap<String, Map<String, String>>();

    while (aProps.containsKey(aIndex+"."+KEY_NAME)) {
      String aPrefix = aIndex+".";
      Map<String, String> aUnit = new HashMap<String, String>();
     
      for (Object aOrigKey : Collections2.filter(aProps.keySet(), new PrefixPredicate(aPrefix))) {
        String aKey = aOrigKey.toString();

        aKey = aKey.substring(aPrefix.length());

        aUnit.put(aKey, aProps.getProperty(aOrigKey.toString()));
      }

      aUnitConfig.put(aProps.getProperty(aIndex+"."+KEY_NAME), aUnit);

      aIndex++;
    }

    for (Object aOrigKey : Collections2.filter(aProps.keySet(), new UnitFilterPredicate())) {
      aGeneralConfig.put(aOrigKey.toString(), aProps.getProperty(aOrigKey.toString()));
    }

    EmpireConfiguration aConfig = new EmpireConfiguration(aGeneralConfig, aUnitConfig);

    if (aGeneralConfig.containsKey(KEY_ANNOTATION_PROVIDER)) {
View Full Code Here

TOP

Related Classes of com.complexible.common.util.EnhancedProperties

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.