/**
   * 取得property的值,不计算表达式。
   *
   * @param prop 属性
   * @param defaultValue 是否使用默认值
   */
  private String getPropertyValue(ConfigProperty prop, boolean defaultValue) {
    Object value = getValues().get(prop.getName());

    if (defaultValue && value == null) {
      value = prop.getDefaultValue();
    }

    if (value instanceof Expression) {
      value = ((Expression) value).getExpressionText();
    }

    if (value instanceof String) {
      String stringValue = (String) value;

      if (stringValue != null) {
        stringValue = stringValue.trim();
      }

      if (stringValue == null || stringValue.length() == 0) {
        stringValue = null;
      }

      return stringValue;
    }

    return value == null ? null : value.toString();
  }
  /**
   * 计算property的值。
   *
   * @param prop 属性
   * @param defaultValue 是否使用默认值
   */
  private String evaluatePropertyValue(ConfigProperty prop, boolean defaultValue) {
    final String ref = prop.getName();
    Object value = getValues().get(ref);

    if (defaultValue && value == null) {
      value = prop.getDefaultValue();

      if (value instanceof String) {
        Expression expr = CompositeExpression.parse((String) value);

        if (expr != null) {
          value = expr;
        }
      }
    }

    if (value instanceof Expression) {
      value =
          ((Expression) value)
              .evaluate(
                  new ExpressionContext() {
                    public Object get(String key) {
                      // 避免无限递归
                      if (ref.equals(key)
                          || StringUtil.getValidIdentifier(ref)
                              .equals(StringUtil.getValidIdentifier(key))) {
                        return null;
                      } else {
                        return getValues().get(key);
                      }
                    }

                    public void put(String key, Object value) {
                      getValues().put(key, value);
                    }
                  });
    }

    if (value instanceof String) {
      String stringValue = (String) value;

      if (stringValue != null) {
        stringValue = stringValue.trim();
      }

      if (stringValue == null || stringValue.length() == 0) {
        stringValue = null;
      }

      return stringValue;
    }

    return value == null ? null : value.toString();
  }