org.apache.felix.utils.properties.Properties.getComments()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.apache.felix.utils.properties.Properties.getComments()方法的一些代码示例,展示了Properties.getComments()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Properties.getComments()方法的具体详情如下:
包路径:org.apache.felix.utils.properties.Properties
类名称:Properties
方法名:getComments

Properties.getComments介绍

暂无

代码示例

代码示例来源:origin: org.apache.felix/org.apache.felix.fileinstall

public List<String> getComments(String key) {
  return storage.getComments(key);
}

代码示例来源:origin: apache/felix

public List<String> getComments(String key) {
  return storage.getComments(key);
}

代码示例来源:origin: org.apache.felix/org.apache.felix.utils

public List<String> getComments(String key) {
  return storage.getComments(key);
}

代码示例来源:origin: org.apache.felix/org.apache.felix.utils

private void ensureTyped() {
  if (!storage.typed) {
    storage.typed = true;
    Set<String> keys = new HashSet<String>(storage.keySet());
    for (String key : keys) {
      storage.put(key,
            storage.getComments(key),
            Arrays.asList(convertToString(storage.get(key)).split("\n")));
    }
  }
}

代码示例来源:origin: org.apache.felix/org.apache.felix.fileinstall

private void ensureTyped() {
  if (!storage.typed) {
    storage.typed = true;
    Set<String> keys = new HashSet<String>(storage.keySet());
    for (String key : keys) {
      storage.put(key,
            storage.getComments(key),
            Arrays.asList(convertToString(storage.get(key)).split("\n")));
    }
  }
}

代码示例来源:origin: apache/felix

private void ensureTyped() {
  if (!storage.typed) {
    storage.typed = true;
    Set<String> keys = new HashSet<String>(storage.keySet());
    for (String key : keys) {
      storage.put(key,
            storage.getComments(key),
            Arrays.asList(convertToString(storage.get(key)).split("\n")));
    }
  }
}

代码示例来源:origin: apache/karaf

private void reformatClauses(Properties config, String key) {
  String val = config.getProperty(key);
  if (val != null && !val.isEmpty()) {
    List<String> comments = config.getComments(key);
    Clause[] clauses = org.apache.felix.utils.manifest.Parser.parseHeader(val);
    Set<String> strings = new LinkedHashSet<>();
    for (Clause clause : clauses) {
      strings.add(clause.toString());
    }
    List<String> lines = new ArrayList<>();
    lines.add("");
    int index = 0;
    for (String string : strings) {
      String s = "    " + string;
      if (index++ < strings.size() - 1) {
        s += ", ";
      }
      lines.add(s);
    }
    config.put(key, comments, lines);
  }
}

代码示例来源:origin: org.apache.karaf.profile/org.apache.karaf.profile.core

private void reformatClauses(Properties config, String key) {
  String val = config.getProperty(key);
  if (val != null && !val.isEmpty()) {
    List<String> comments = config.getComments(key);
    Clause[] clauses = org.apache.felix.utils.manifest.Parser.parseHeader(val);
    Set<String> strings = new LinkedHashSet<>();
    for (Clause clause : clauses) {
      strings.add(clause.toString());
    }
    List<String> lines = new ArrayList<>();
    lines.add("");
    int index = 0;
    for (String string : strings) {
      String s = "    " + string;
      if (index++ < strings.size() - 1) {
        s += ", ";
      }
      lines.add(s);
    }
    config.put(key, comments, lines);
  }
}

代码示例来源:origin: org.apache.felix/org.apache.felix.fileinstall

public boolean update(Properties properties) {
  boolean modified = false;
  // Remove "removed" properties from the cfg file
  for (String key : new ArrayList<String>(this.keySet())) {
    if (!properties.containsKey(key)) {
      this.remove(key);
      modified = true;
    }
  }
  // Update existing keys
  for (String key : properties.keySet()) {
    String v = this.get(key);
    List<String> comments = properties.getComments(key);
    List<String> value = properties.getRaw(key);
    if (v == null) {
      this.put(key, comments, value);
      modified = true;
    } else if (!v.equals(properties.get(key))) {
      if (comments.isEmpty()) {
        comments = this.getComments(key);
      }
      this.put(key, comments, value);
      modified = true;
    }
  }
  return modified;
}

代码示例来源:origin: org.apache.felix/org.apache.felix.utils

public boolean update(Properties properties) {
  boolean modified = false;
  // Remove "removed" properties from the cfg file
  for (String key : new ArrayList<String>(this.keySet())) {
    if (!properties.containsKey(key)) {
      this.remove(key);
      modified = true;
    }
  }
  // Update existing keys
  for (String key : properties.keySet()) {
    String v = this.get(key);
    List<String> comments = properties.getComments(key);
    List<String> value = properties.getRaw(key);
    if (v == null) {
      this.put(key, comments, value);
      modified = true;
    } else if (!v.equals(properties.get(key))) {
      if (comments.isEmpty()) {
        comments = this.getComments(key);
      }
      this.put(key, comments, value);
      modified = true;
    }
  }
  return modified;
}

代码示例来源:origin: apache/felix

public boolean update(Properties properties) {
  boolean modified = false;
  // Remove "removed" properties from the cfg file
  for (String key : new ArrayList<String>(this.keySet())) {
    if (!properties.containsKey(key)) {
      this.remove(key);
      modified = true;
    }
  }
  // Update existing keys
  for (String key : properties.keySet()) {
    String v = this.get(key);
    List<String> comments = properties.getComments(key);
    List<String> value = properties.getRaw(key);
    if (v == null) {
      this.put(key, comments, value);
      modified = true;
    } else if (!v.equals(properties.get(key))) {
      if (comments.isEmpty()) {
        comments = this.getComments(key);
      }
      this.put(key, comments, value);
      modified = true;
    }
  }
  return modified;
}

相关文章