public class NSProperties extends XProperties
xmlns\:fileStore=http://my.ns/fileStore# xmlns\:email=myproxy:ncsa,2011/1.1/email# fileStore\:dataPath=/tmp/data fileStore\:indexPath=/tmp/index email\:enabled=false(The "\" on the left-hand side is colon escaping from the Java Properties class.) In which case you could retrieve values as getBoolean("email", "enabled") or getBoolean("myproxy:ncsa,2011/1.1/email#enabled") You may add or remove prefixes by calling the appropriate
addNSPrefix(String, String)
method. These will be saved as part of the properties file.Modifier and Type | Class and Description |
---|---|
class |
NSProperties.StringLengthComparator |
Modifier and Type | Field and Description |
---|---|
static String |
XMLNS_PREFIX |
DEFAULT_LIST_SEPARATOR, LOGICAL_FALSES, LOGICAL_TRUES, storeFileName
defaults
Constructor and Description |
---|
NSProperties() |
Modifier and Type | Method and Description |
---|---|
void |
addNSPrefix(String ns,
String prefix) |
boolean |
getBoolean(String ns,
String key) |
byte[] |
getBytes(String ns,
String key) |
Date |
getDate(String ns,
String key) |
double |
getDouble(String ns,
String key) |
File |
getFile(String ns,
String key) |
File |
getFile(String ns,
String key,
File parent) |
int |
getInt(String ns,
String key) |
String[] |
getListByNS(String ns,
String key)
Get the list using the namespace.
|
String[] |
getListByNS(String ns,
String key,
String separator)
Get the list using the namespace and the separator.
|
long |
getLong(String ns,
String key) |
Collection<String> |
getNamespaces() |
protected HashMap<String,String> |
getNsToPrefix()
Support for namespace resolution.
|
Collection<String> |
getPrefixes() |
HashMap<String,String> |
getPrefixToNS() |
Object |
getSerializable(String ns,
String key) |
Object[] |
getSerializableList(String ns,
String key) |
String |
getString(String ns,
String key) |
URI |
getURI(String ns,
String key) |
URL |
getURL(String ns,
String key) |
void |
list(PrintStream out) |
void |
load(InputStream inStream) |
void |
removeNS(String ns) |
protected String |
resolveKey(String ns,
String key)
Resolve a namespace to a single key.
|
void |
setBoolean(String ns,
String key,
boolean value) |
void |
setBytes(String ns,
String key,
byte[] ba) |
void |
setDate(String ns,
String key,
Date d) |
void |
setDouble(String ns,
String key,
double value) |
void |
setFile(String ns,
String key,
File f) |
void |
setInt(String ns,
String key,
int value) |
void |
setList(String ns,
String key,
String list) |
void |
setList(String ns,
String key,
String[] list) |
void |
setList(String ns,
String key,
String[] list,
String separator) |
void |
setLong(String ns,
String key,
long value) |
Object |
setProperty(String ns,
String key,
String value) |
void |
setSerializable(String ns,
String key,
Serializable object) |
void |
setSerializableList(String ns,
String key,
Object[] oList) |
void |
setString(String ns,
String key,
String value) |
void |
setURI(String ns,
String key,
String uriString) |
void |
setURI(String ns,
String key,
URI uri) |
void |
setURL(String ns,
String key,
String urlString) |
void |
setURL(String ns,
String key,
URL url) |
void |
store(OutputStream os,
String header) |
protected String |
toNS(String key)
Given a key with a prefix or a namespace, resolve it to the namepsace + key.
|
protected String |
toPrefix(String key)
Given a namespace, or a prefix, resolve to the actual namespace.
|
add, add, add, clone, equals, getBoolean, getBytes, getClone, getDate, getDouble, getFile, getFile, getInt, getList, getList, getListSeparator, getLong, getSerializable, getSerializableList, getStoreFileName, getString, getURI, getURL, isEmpty, keySubset, load, load, load, main, setBoolean, setBytes, setDate, setDouble, setFile, setInt, setList, setList, setList, setListSeparator, setLong, setProperty, setSerializable, setSerializableList, setStoreFileName, setString, setURI, setURI, setURL, setURL, store, store, toString
getProperty, getProperty, list, load, loadFromXML, propertyNames, save, store, storeToXML, storeToXML, stringPropertyNames
clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, forEach, get, getOrDefault, hashCode, keys, keySet, merge, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, size, toString, values
public static final String XMLNS_PREFIX
public void removeNS(String ns)
public Collection<String> getNamespaces()
public Collection<String> getPrefixes()
protected HashMap<String,String> getNsToPrefix()
protected String resolveKey(String ns, String key)
XProperties.NAMESPACE_DELIMITER
is needed.
If there is no namespace provided, this just returns the key.ns
- key
- protected String toPrefix(String key)
key
- protected String toNS(String key)
key
- public void setSerializable(String ns, String key, Serializable object)
public String[] getListByNS(String ns, String key, String separator)
public String[] getListByNS(String ns, String key)
ns
- key
- public void load(InputStream inStream) throws IOException
load
in class Properties
IOException
public void store(OutputStream os, String header)
store
in class Properties
public void list(PrintStream out)
list
in class Properties
Copyright © 2019. All Rights Reserved.