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

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

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

Properties.put介绍

暂无

代码示例

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

/**
 * Calls the map method put. Provided for parallelism with the getProperty method.
 * Enforces use of strings for property keys and values. The value returned is the result of the map call to put.
 *
 * @param key the key to be placed into this property list.
 * @param value the value corresponding to the key.
 * @return the previous value of the specified key in this property list, or null if it did not have one.
 */
public Object setProperty(String key, String value) {
  return this.put(key, value);
}

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

/**
 * Calls the map method put. Provided for parallelism with the getProperty method.
 * Enforces use of strings for property keys and values. The value returned is the result of the map call to put.
 *
 * @param key the key to be placed into this property list.
 * @param value the value corresponding to the key.
 * @return the previous value of the specified key in this property list, or null if it did not have one.
 */
public Object setProperty(String key, String value) {
  return this.put(key, value);
}

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

/**
 * Calls the map method put. Provided for parallelism with the getProperty method.
 * Enforces use of strings for property keys and values. The value returned is the result of the map call to put.
 *
 * @param key the key to be placed into this property list.
 * @param value the value corresponding to the key.
 * @return the previous value of the specified key in this property list, or null if it did not have one.
 */
public Object setProperty(String key, String value) {
  return this.put(key, value);
}

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

public Object put(String key, List<String> commentLines, List<String> valueLines) {
  String old = storage.put(key, commentLines, valueLines);
  return old != null ? storage.typed ? convertFromString(old) : old : null;
}

代码示例来源:origin: io.fabric8/fabric-zookeeper

private void markCreated(BundleContext bundleContext) throws IOException {
  File marker = new File(dataDir, ENSEMBLE_MARKER);
  if (!marker.exists() && !marker.getParentFile().exists() && !marker.getParentFile().mkdirs()) {
    throw new IOException("Cannot create marker file");
  }
  org.apache.felix.utils.properties.Properties props = new org.apache.felix.utils.properties.Properties(marker);
  props.put("created", "true");
  props.save();
}

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

public boolean update(Map<String, String> props) {
  Properties properties;
  if (props instanceof Properties) {
    properties = (Properties) props;
  } else {
    properties = new Properties();
    for (Map.Entry<? extends String, ? extends String> e : props.entrySet()) {
      properties.put(e.getKey(), e.getValue());
    }
  }
  return update(properties);
}

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

public boolean update(Map<String, String> props) {
  Properties properties;
  if (props instanceof Properties) {
    properties = (Properties) props;
  } else {
    properties = new Properties();
    for (Map.Entry<? extends String, ? extends String> e : props.entrySet()) {
      properties.put(e.getKey(), e.getValue());
    }
  }
  return update(properties);
}

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

public boolean update(Map<String, String> props) {
  Properties properties;
  if (props instanceof Properties) {
    properties = (Properties) props;
  } else {
    properties = new Properties();
    for (Map.Entry<? extends String, ? extends String> e : props.entrySet()) {
      properties.put(e.getKey(), e.getValue());
    }
  }
  return update(properties);
}

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

@Override
public Object put(String key, Object value) {
  if (value instanceof String && !storage.typed) {
    return storage.put(key, (String) value);
  } else {
    ensureTyped();
    String old = storage.put(key, convertToString(value));
    return old != null ? convertFromString(old) : null;
  }
}

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

@Override
public Object put(String key, Object value) {
  if (value instanceof String && !storage.typed) {
    return storage.put(key, (String) value);
  } else {
    ensureTyped();
    String old = storage.put(key, convertToString(value));
    return old != null ? convertFromString(old) : null;
  }
}

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

@Override
public Object put(String key, Object value) {
  if (value instanceof String && !storage.typed) {
    return storage.put(key, (String) value);
  } else {
    ensureTyped();
    String old = storage.put(key, convertToString(value));
    return old != null ? convertFromString(old) : null;
  }
}

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

private static void trimValues(Properties configProps) {
  for (String key : configProps.keySet()) {
    configProps.put(key, configProps.get(key).trim());
  }
}

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

public void setFramework(FrameworkType framework) {
  if (framework == null) {
    return;
  }
  try {
    Properties properties = loadProps();
    properties.put("karaf.framework", framework.name());
    properties.save();
  } catch (IOException e) {
    throw new RuntimeException("Error setting framework: " + e.getMessage(), e);
  }
}

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

public Object put(String key, List<String> commentLines, Object value) {
  if (value instanceof String && !storage.typed) {
    return storage.put(key, commentLines, (String) value);
  } else {
    ensureTyped();
    return put(key, commentLines, Arrays.asList(convertToString(value).split("\n")));
  }
}

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

public Object put(String key, List<String> commentLines, Object value) {
  if (value instanceof String && !storage.typed) {
    return storage.put(key, commentLines, (String) value);
  } else {
    ensureTyped();
    return put(key, commentLines, Arrays.asList(convertToString(value).split("\n")));
  }
}

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

public Object put(String key, List<String> commentLines, Object value) {
  if (value instanceof String && !storage.typed) {
    return storage.put(key, commentLines, (String) value);
  } else {
    ensureTyped();
    return put(key, commentLines, Arrays.asList(convertToString(value).split("\n")));
  }
}

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

public void setFramework(FrameworkType framework) {
  if (framework == null) {
    return;
  }
  try {
    Properties properties = loadProps();
    properties.put("karaf.framework", framework.name());
    properties.save();
  } catch (IOException e) {
    throw new RuntimeException("Error setting framework: " + e.getMessage(), e);
  }
}

代码示例来源: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")));
    }
  }
}

相关文章