本文整理了Java中org.apache.commons.validator.Var.clone()
方法的一些代码示例,展示了Var.clone()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Var.clone()
方法的具体详情如下:
包路径:org.apache.commons.validator.Var
类名称:Var
方法名:clone
[英]Creates and returns a copy of this object.
[中]创建并返回此对象的副本。
代码示例来源:origin: commons-validator/commons-validator
/**
* Makes a deep copy of a <code>Map</code> if the values are
* <code>Msg</code>, <code>Arg</code>, or <code>Var</code>. Otherwise,
* it is a shallow copy.
*
* @param map The source Map to copy.
*
* @return A copy of the <code>Map</code> that was passed in.
*/
public static Map<String, Object> copyMap(Map<String, Object> map) {
Map<String, Object> results = new HashMap<String, Object>();
Iterator<Entry<String, Object>> i = map.entrySet().iterator();
while (i.hasNext()) {
Entry<String, Object> entry = i.next();
String key = entry.getKey();
Object value = entry.getValue();
if (value instanceof Msg) {
results.put(key, ((Msg) value).clone());
} else if (value instanceof Arg) {
results.put(key, ((Arg) value).clone());
} else if (value instanceof Var) {
results.put(key, ((Var) value).clone());
} else {
results.put(key, value);
}
}
return results;
}
代码示例来源:origin: commons-validator/commons-validator
results.put(key, ((Arg) value).clone());
} else if (value instanceof Var) {
results.put(key, ((Var) value).clone());
} else {
results.put(key, value);
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.validator
/**
* Makes a deep copy of a <code>Map</code> if the values are
* <code>Msg</code>, <code>Arg</code>, or <code>Var</code>. Otherwise,
* it is a shallow copy.
*
* @param map The source Map to copy.
*
* @return A copy of the <code>Map</code> that was passed in.
*/
public static Map copyMap(Map map) {
Map results = new HashMap();
Iterator iter = map.keySet().iterator();
while (iter.hasNext()) {
String key = (String) iter.next();
Object value = map.get(key);
if (value instanceof Msg) {
results.put(key, ((Msg) value).clone());
} else if (value instanceof Arg) {
results.put(key, ((Arg) value).clone());
} else if (value instanceof Var) {
results.put(key, ((Var) value).clone());
} else {
results.put(key, value);
}
}
return results;
}
代码示例来源:origin: de.knightsoft-net/gwt-commons-validator
/**
* Makes a deep copy of a <code>Map</code> if the values are
* <code>Msg</code>, <code>Arg</code>, or <code>Var</code>. Otherwise,
* it is a shallow copy.
*
* @param map The source Map to copy.
*
* @return A copy of the <code>Map</code> that was passed in.
*/
@GwtIncompatible("incompatible method")
public static Map<String, Object> copyMap(Map<String, Object> map) {
Map<String, Object> results = new HashMap<String, Object>();
Iterator<Entry<String, Object>> i = map.entrySet().iterator();
while (i.hasNext()) {
Entry<String, Object> entry = i.next();
String key = entry.getKey();
Object value = entry.getValue();
if (value instanceof Msg) {
results.put(key, ((Msg) value).clone());
} else if (value instanceof Arg) {
results.put(key, ((Arg) value).clone());
} else if (value instanceof Var) {
results.put(key, ((Var) value).clone());
} else {
results.put(key, value);
}
}
return results;
}
代码示例来源:origin: de.knightsoft-net/gwt-commons-validator
results.put(key, ((Arg) value).clone());
} else if (value instanceof Var) {
results.put(key, ((Var) value).clone());
} else {
results.put(key, value);
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.validator
results.put(key, ((Arg) value).clone());
} else if (value instanceof Var) {
results.put(key, ((Var) value).clone());
} else {
results.put(key, value);
内容来源于网络,如有侵权,请联系作者删除!