コード例 #1
0
 protected void setParameterBase(ParameterBase parameterBase) {
   this.parameterBase = parameterBase;
   String codeName = parameterBase.getCodeName();
   if (codeName == null) codeName = "";
   this.simpleName =
       String.format(
           "%s/%s/%s",
           parameterBase.getComponentName(), codeName, parameterBase.getParameterName());
 }
コード例 #2
0
  /**
   * creates a String to be included in a .preperties file
   *
   * @param value default value to be included in the text
   * @return
   */
  public String toPropertyString(String value, boolean commentOutValue) {
    if (value == null) {
      value = "";
    }
    StringBuilder builder = new StringBuilder();
    String pathName = parameterBase.getPath().toString();
    builder.append("\n#********  ").append(pathName);
    if (description != null) {
      String withPounds = description.replaceAll("\n", "\n#");
      builder.append('\n').append("#** ").append(withPounds);
    }
    if (isNotModifiableAtRuntime()) {
      builder.append("\n#**  static parameter (not modifiable at runtime)");
    }
    if (constraints != null && !"".equals(constraints.trim())) {
      builder
          .append("\n#** constraints : ")
          .append(constraints)
          .append(" ; type : ")
          .append(TypeInfos.get(parameterBase.getTypeName()));
    } else {
      builder.append("\n#** type : ").append(TypeInfos.get(parameterBase.getTypeName()));
    }
    if (category != null && !"".equals(category.trim())) {
      builder.append("\n#** category : ").append(category);
    }
    String propName = this.simpleName;
    if (propName == null || "".equals(propName.trim())) {
      propName = pathName;
    } else {
      propName = propName.trim().replaceAll(" ", "\\\\ ");
    }
    builder
        .append("\n#**\n#********\n\n")
        .append(commentOutValue ? "#" : "")
        .append(propName)
        .append(" = ")
        .append(value)
        .append('\n');

    // System.out.println(" -> -> " +builder );
    return builder.toString();
  }
コード例 #3
0
  /**
   * equals is special: it works with any Path Object!
   *
   * @param o
   * @return
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (!(o instanceof PathObject)) return false;

    PathObject that = (PathObject) o;

    if (!parameterBase.getPath().equals(that.getPath())) return false;

    return true;
  }
コード例 #4
0
 public String getTypeName() {
   return parameterBase.getTypeName();
 }
コード例 #5
0
 @Override
 public ParameterPath getPath() {
   return parameterBase.getPath();
 }
コード例 #6
0
 public String getDefaultValue() {
   return parameterBase.getDefaultValue();
 }
コード例 #7
0
 public String getParameterName() {
   return parameterBase.getParameterName();
 }
コード例 #8
0
 public String getComponentName() {
   return parameterBase.getComponentName();
 }
コード例 #9
0
 @Override
 public int hashCode() {
   return parameterBase.getPath().hashCode();
 }