mirror of
https://github.com/apache/openjpa.git
synced 2025-02-23 02:48:46 +00:00
OPENJPA-927 Committing code contributed by Dianne Richards
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@750112 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8bf4da08ff
commit
730ff8813e
@ -53,6 +53,7 @@ import java.util.Map;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@ -125,6 +126,8 @@ public class ConfigurationImpl
|
||||
// cache descriptors
|
||||
private PropertyDescriptor[] _pds = null;
|
||||
private MethodDescriptor[] _mds = null;
|
||||
|
||||
private boolean getVisibleOnly = false;
|
||||
|
||||
/**
|
||||
* Default constructor. Attempts to load default properties through
|
||||
@ -589,11 +592,11 @@ public class ConfigurationImpl
|
||||
// hashcode contracts
|
||||
Map<String, String> clone;
|
||||
if (_props == null)
|
||||
clone = new HashMap<String, String>();
|
||||
clone = new TreeMap<String, String>();
|
||||
else if (_props instanceof Properties)
|
||||
clone = (Map) ((Properties) _props).clone();
|
||||
else
|
||||
clone = new HashMap<String, String>(_props);
|
||||
clone = new TreeMap<String, String>(_props);
|
||||
|
||||
// if no existing properties or the properties should contain entries
|
||||
// with default values, add values to properties
|
||||
@ -613,13 +616,17 @@ public class ConfigurationImpl
|
||||
setValue(clone, val, str);
|
||||
}
|
||||
if (_props == null)
|
||||
_props = new HashMap(clone);
|
||||
_props = new TreeMap(clone);
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
public Map<String, String> getAllProperties() {
|
||||
return toProperties(true, true);
|
||||
boolean saveGetVisibleOnly = getVisibleOnly;
|
||||
getVisibleOnly = true;
|
||||
Map<String, String> properties = toProperties(true, true);
|
||||
getVisibleOnly = saveGetVisibleOnly;
|
||||
return properties;
|
||||
}
|
||||
|
||||
public Map<String, String> toProperties(boolean storeDefaults) {
|
||||
@ -725,6 +732,9 @@ public class ConfigurationImpl
|
||||
}
|
||||
}
|
||||
}
|
||||
if (getVisibleOnly && !val.isVisible()) {
|
||||
return;
|
||||
}
|
||||
map.put(key, o);
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,7 @@ public abstract class Value implements Cloneable {
|
||||
private boolean isDynamic = false;
|
||||
private String originalValue = null;
|
||||
private Set<String> otherNames = null;
|
||||
private boolean visible = true;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
@ -550,4 +551,12 @@ public abstract class Value implements Cloneable {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void setVisible(boolean visible) {
|
||||
this.visible = visible;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user