本文整理了Java中azkaban.utils.Props.localKeySet()
方法的一些代码示例,展示了Props.localKeySet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Props.localKeySet()
方法的具体详情如下:
包路径:azkaban.utils.Props
类名称:Props
方法名:localKeySet
[英]Get the key set from the current Props
[中]从当前道具中获取密钥集
代码示例来源:origin: azkaban/azkaban
/**
* Returns a set of all keys, including the parents
*/
public Set<String> getKeySet() {
final HashSet<String> keySet = new HashSet<>();
keySet.addAll(localKeySet());
if (this._parent != null) {
keySet.addAll(this._parent.getKeySet());
}
return keySet;
}
代码示例来源:origin: azkaban/azkaban
public static Map<String, String> toStringMap(final Props props, final boolean localOnly) {
final HashMap<String, String> map = new HashMap<>();
final Set<String> keyset = localOnly ? props.localKeySet() : props.getKeySet();
for (final String key : keyset) {
final String value = props.get(key);
map.put(key, value);
}
return map;
}
代码示例来源:origin: azkaban/azkaban
/**
* Get a map of all properties by string prefix
*
* @param prefix The string prefix
*/
public Map<String, String> getMapByPrefix(final String prefix) {
final Map<String, String> values = this._parent == null ? new HashMap<>() :
this._parent.getMapByPrefix(prefix);
// when there is a conflict, value from the child takes the priority.
for (final String key : this.localKeySet()) {
if (key.startsWith(prefix)) {
values.put(key.substring(prefix.length()), get(key));
}
}
return values;
}
代码示例来源:origin: azkaban/azkaban
/**
* Store all properties, those local and also those in parent props
*
* @param out The stream to write to
* @throws IOException If there is an error writing
*/
public void storeFlattened(final OutputStream out) throws IOException {
final Properties p = new Properties();
for (Props curr = this; curr != null; curr = curr.getParent()) {
for (final String key : curr.localKeySet()) {
if (!p.containsKey(key)) {
p.setProperty(key, get(key));
}
}
}
p.store(out, null);
}
代码示例来源:origin: azkaban/azkaban
/**
* Puts only the local props from p into the current properties
*/
public void putLocal(final Props p) {
for (final String key : p.localKeySet()) {
this.put(key, p.get(key));
}
}
代码示例来源:origin: azkaban/azkaban
/**
*
* @param source
* @return
*/
private static Props copyNext(final Props source) {
Props priorNodeCopy = null;
if (source.getParent() != null) {
priorNodeCopy = copyNext(source.getParent());
}
final Props dest = new Props(priorNodeCopy);
for (final String key : source.localKeySet()) {
dest.put(key, source.get(key));
}
return dest;
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
/**
* Returns a set of all keys, including the parents
*
* @return
*/
public Set<String> getKeySet() {
HashSet<String> keySet = new HashSet<String>();
keySet.addAll(localKeySet());
if (_parent != null) {
keySet.addAll(_parent.getKeySet());
}
return keySet;
}
代码示例来源:origin: com.linkedin.azkaban/az-core
/**
* Returns a set of all keys, including the parents
*
* @return the key set
*/
public Set<String> getKeySet() {
final HashSet<String> keySet = new HashSet<>();
keySet.addAll(localKeySet());
if (this._parent != null) {
keySet.addAll(this._parent.getKeySet());
}
return keySet;
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
public static Map<String, String> toStringMap(Props props, boolean localOnly) {
HashMap<String, String> map = new HashMap<String, String>();
Set<String> keyset = localOnly ? props.localKeySet() : props.getKeySet();
for (String key: keyset) {
String value = props.get(key);
map.put(key, value);
}
return map;
}
代码示例来源:origin: com.linkedin.azkaban/az-core
/**
* Get a map of all properties by string prefix
*
* @param prefix The string prefix
* @return the map by prefix
*/
public Map<String, String> getMapByPrefix(final String prefix) {
final Map<String, String> values = this._parent == null ? new HashMap<>() :
this._parent.getMapByPrefix(prefix);
// when there is a conflict, value from the child takes the priority.
for (final String key : this.localKeySet()) {
if (key.startsWith(prefix)) {
values.put(key.substring(prefix.length()), get(key));
}
}
return values;
}
代码示例来源:origin: com.linkedin.azkaban/az-core
/**
* Store all properties, those local and also those in parent props
*
* @param out The stream to write to
* @throws IOException If there is an error writing
*/
public void storeFlattened(final OutputStream out) throws IOException {
final Properties p = new Properties();
for (Props curr = this; curr != null; curr = curr.getParent()) {
for (final String key : curr.localKeySet()) {
if (!p.containsKey(key)) {
p.setProperty(key, get(key));
}
}
}
p.store(out, null);
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
/**
* Get a map of all properties by string prefix
*
* @param prefix
* The string prefix
*/
public Map<String, String> getMapByPrefix(String prefix) {
Map<String, String> values = new HashMap<String, String>();
if (_parent != null) {
for (Map.Entry<String, String> entry : _parent.getMapByPrefix(
prefix).entrySet()) {
values.put(entry.getKey(), entry.getValue());
}
}
for (String key : this.localKeySet()) {
if (key.startsWith(prefix)) {
values.put(key.substring(prefix.length()), get(key));
}
}
return values;
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
/**
* Store all properties, those local and also those in parent props
*
* @param out
* The stream to write to
* @throws IOException
* If there is an error writing
*/
public void storeFlattened(OutputStream out) throws IOException {
Properties p = new Properties();
for (Props curr = this; curr != null; curr = curr.getParent()) {
for (String key : curr.localKeySet()) {
if (!p.containsKey(key)) {
p.setProperty(key, get(key));
}
}
}
p.store(out, null);
}
代码示例来源:origin: com.linkedin.azkaban/az-core
/**
* To string map map.
*
* @param props the props
* @param localOnly the local only
* @return the map
*/
public static Map<String, String> toStringMap(final Props props, final boolean localOnly) {
final HashMap<String, String> map = new HashMap<>();
final Set<String> keyset = localOnly ? props.localKeySet() : props.getKeySet();
for (final String key : keyset) {
final String value = props.get(key);
map.put(key, value);
}
return map;
}
代码示例来源:origin: com.linkedin.azkaban/az-core
/**
* Puts only the local props from p into the current properties
*
* @param p the p
*/
public void putLocal(final Props p) {
for (final String key : p.localKeySet()) {
this.put(key, p.get(key));
}
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
/**
* Puts only the local props from p into the current properties
*
* @param p
*/
public void putLocal(Props p) {
for (String key : p.localKeySet()) {
this.put(key, p.get(key));
}
}
代码示例来源:origin: com.linkedin.azkaban/az-core
/**
*
* @param source
* @return
*/
private static Props copyNext(final Props source) {
Props priorNodeCopy = null;
if (source.getParent() != null) {
priorNodeCopy = copyNext(source.getParent());
}
final Props dest = new Props(priorNodeCopy);
for (final String key : source.localKeySet()) {
dest.put(key, source.get(key));
}
return dest;
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
/**
*
* @param source
* @return
*/
private static Props copyNext(Props source) {
Props priorNodeCopy = null;
if (source.getParent() != null) {
priorNodeCopy = copyNext(source.getParent());
}
Props dest = new Props(priorNodeCopy);
for (String key : source.localKeySet()) {
dest.put(key, source.get(key));
}
return dest;
}
内容来源于网络,如有侵权,请联系作者删除!