Пример #1
0
  @Override
  public ConfigObject getAsConfig(String configId) {
    if (configId == null) {
      if (this.configId == null) {
        throw new IllegalArgumentException("Can't derive configId (none was supplied)");
      } else {
        configId = this.configId;
      }
    }

    ConfigObject root = new ConfigObject();
    ConfigObject filterAliases = (ConfigObject) root.getProperty(FILTERS_CONFIG_KEY);
    if (noRegex) {
      ConfigObject filterConfig = (ConfigObject) filterAliases.getProperty(configId);
      filterConfig.put(FILTERS_CONFIG_VALUE_KEY, givenFilterPattern);
      filterConfig.put(FILTERS_CONFIG_REGEX_KEY, noRegex);
    } else {
      filterAliases.put(configId, givenFilterPattern);
    }
    return root;
  }
  /**
   * @param co current config object which is queried
   * @param currentNamePart the queried property name
   * @return the value for given property name
   * @throws ObjectNotFoundException
   */
  private Object configObjectGet(ConfigObject co, String currentNamePart) {

    /*
     * get the property value
     */
    Object result = co.getProperty(currentNamePart);

    if (result instanceof ConfigObject) {
      // try if property value is empty
      ConfigObject coResult = (ConfigObject) result;
      if (coResult.size() == 0) {
        throw new ObjectNotFoundException();
      }
    } else {
      result = resolvePropObject(result);
    } // fi
    return result;
  }