@MinDoc(copyright="Copyright 2004 - 2008, 2009, 2016 A. Weinert", author="Albrecht Weinert", version="V.56", lastModified="28.06.2021", usage="3 phase: make, populate, use (preferably not further modified)", purpose="initial properties for applications and other objects") public class PropMap extends AbstractMap<CharSequence,String> implements ConcurrentMap<CharSequence,String>, Cloneable, Serializable
PropMap object features a set of String-String key value pairs.
So it is a Map. The class is quite similar to
java.util.Properties respectively to
java.util.Dictionary. Under circumstances,
often given and defined below, PropMap is the better choice
than any of the standard Maps.Map freedoms are limited a bit (beyond
<CharSequence, String>):Strings).Map, keys are unique. A
PropMap object is by this condition a set (Set);
see also entrySet() respectively keySet()).CharSequences as
parameter for the key, which they strip from surrounding white spaces,
should those be there. See
TextHelper.trimUq(..). If the key is then still not empty, it is
accepted and used as such.PropMap is the parent of AppLangMap
and de.frame4j.util.Prop in the same package. The pedigree
Prop -> PropMap
-> AbstractMap separates
Collection's aspects clearly from many extra
services for applications, Servlets and else, especially for
de.frame4j.util.App's inheritors.PropMap, its inner classes
PropMapHelper.Entry, PropMap.EntrySet and
PropMap.KeySet, as well as Prop and
AppLangMap and the Java-Collection-Framework's classes and
interfaces.
PropMap (and of its inheritor
Prop) is the settings of modes and options as
well as the handling and evaluation of start parameters for applications
of all kinds as well as for other single objects (Beans).uhu9 uhu09 uhu[9] de.uhu de_DE.uhu en_GB.uhu[123].Prop.parse(String[], CharSequence)) means for such use cases, that
a "Map" of (application) properties
Entrys" up to about 200,
more being exceptionalPropMap and its
extensions may be a good choice even when the extra features and services
are not needed.subSet(CharSequence)).Properties is willing to forbear. Here it is used to
distinguish an empty from a not yet set value. If that difference is not
needed or disturbing it can be masked away by usinggetString(key, "")
bzw.
getString(key,
ComVar.EMPTY_STRING),equals(Object) and hashCode() of
standard containers (including the parent class AbstractMap) are
(have to be) quite expensive. They are optimised here finally.de.frame4j,
App,
de.frame4j.util,
TextHelper,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
class |
PropMap.EntrySet
The entries as Set.
|
class |
PropMap.KeySet<S>
The keys as Set.
|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Field and Description |
|---|---|
protected PropMapHelper.Entry[] |
entries
The entries.
|
static int |
FILE_LIST_LEN
Maximum length of loaded .properties files or resources list.
|
protected int |
hashMissMax
Maximum of "hash miss side steps".
|
protected int |
hashMissSum
Summed up "hash miss side steps".
|
protected AbstractSet<Map.Entry<CharSequence,String>> |
internalEntrySet
Entry set view (singleton).
|
protected PropMap.KeySet<CharSequence> |
internalKeySet
KeySet view (singleton).
|
static String |
keyStringMld
Message on key to be non empty a character sequence,
for exceptions.
|
protected String |
language
The (preferred) language of this PropMap.
|
protected String |
region
The (preferred) region of this PropMap.
|
protected int |
reHashes
Summed up re-hashes (since new or empty).
|
protected ReentrantReadWriteLock.ReadLock |
rLock
The lock for reads.
|
static String |
valStringMld
Message on value to be a character sequence, for exceptions.
|
static int |
VL_CL
Cache size for valueLang() look up.
|
protected ReentrantReadWriteLock.WriteLock |
wLock
The lock for writes.
|
| Constructor and Description |
|---|
PropMap()
Make an empty set of properties.
|
PropMap(int startCap)
Make an empty set of properties, choosing the starting capacity.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(CharSequence key,
CharSequence value)
Adding a new property.
|
Properties |
asProperties(CharSequence filter)
The content as Properties.
|
void |
clear()
Clear / forget all.
|
void |
clear(int startCap)
Clear / forget all and choose starting capacity.
|
Object |
clone()
A copy of this PropMap.
|
boolean |
containsKey(Object key)
Is there a certain key.
|
boolean |
containsValue(Object value)
Is there a value.
|
void |
deepIt()
"Deepening" a preceding clone().
|
PropMapHelper.Entry |
entry(CharSequence key)
Get the entry for a key.
|
Set<Map.Entry<CharSequence,String>> |
entrySet()
The entries as Set.
|
boolean |
equals(Object o)
Equality with other object.
|
String |
get(Object key)
Get the value for a key.
|
boolean |
getBoolean(CharSequence name)
Get a property as boolean.
|
boolean |
getBoolean(CharSequence name,
boolean defV)
Get a property as boolean with default.
|
boolean |
getBoolean(CharSequence name,
int num,
boolean defV)
Get a "numbered / indexed" property as boolean with default.
|
int |
getInt(CharSequence name,
int defV)
Get a property as int.
|
int |
getInt(String name,
int num,
int defV)
Get a "numbered / indexed" property as int with default.
|
String |
getLanguage()
The (preferred) language of this PropMap.
|
long |
getLong(CharSequence name,
long defV)
Get a property as long.
|
String |
getProperty(CharSequence key,
int num,
String defV)
Get a "numbered / indexed" property as String.
|
String |
getProperty(CharSequence key,
String defaultValue)
Get a value for a key with default.
|
String |
getProperty(CharSequence key,
String pref1,
String pref2,
String defV)
Get a property wit a (may be) prefixed key.
|
String |
getProperty(String name)
Get a property as String.
|
String |
getRegion()
The (preferred) region of this PropMap.
|
String |
getString(CharSequence name)
Get a property as non empty String.
|
String |
getString(CharSequence key,
String defV)
Get a property if non empty String.
|
int |
hashCode()
The whole maps hash code.
|
StringBuilder |
hashQuality(StringBuilder bastel)
The hash quality as two line String.
|
int |
indexOfKey(CharSequence key)
Find the index for a key.
|
boolean |
isEmpty()
Is it empty.
|
Set<CharSequence> |
keySet()
The keys as Set.
|
void |
load(InputStream input,
CharSequence encoding)
Load key value pairs from an input stream.
|
boolean |
load1(CharSequence fileName,
CharSequence encoding)
Load properties from (just) one text file.
|
boolean |
load1(Class<?> cl,
CharSequence fileName,
CharSequence encoding)
Load properties from a text file, class related.
|
String |
put(CharSequence key,
String value)
Enter a key value pair.
|
PropMapHelper.Entry |
put(PropMapHelper.Entry newEntry)
Enter a key value pair as Entry.
|
void |
putAll(Map<? extends CharSequence,? extends String> map)
Take all entries from another
Map. |
String |
putIfAbsent(CharSequence key,
String value)
Putting a new property.
|
protected String |
putImpl(String key,
CharSequence value)
Enter a key/value pair.
|
protected void |
putNewImpl(String key,
String value)
Enter a key/value pair, guaranteed to be new.
|
protected void |
putNewImut(String key,
String value)
Enter a new immutable key/value pair.
|
void |
rehash()
Re-hash.
|
protected void |
rehash(PropMapHelper.Entry newEnt,
int ensCap)
Re-hash.
|
protected boolean |
remove(int i)
Remove an Entry by (internal) index.
|
String |
remove(Object key)
Remove an entry.
|
boolean |
remove(Object key,
Object value)
Remove an entry.
|
String |
replace(CharSequence key,
String value)
Replace an entry's value.
|
boolean |
replace(CharSequence key,
String oldValue,
String newValue)
Replace an entry's value.
|
void |
setLanguage(CharSequence language)
Set the (preferred) language of this PropMap.
|
boolean |
setNewProperty(CharSequence keyValue)
Set a new property.
|
boolean |
setNewProperty(CharSequence key,
String value)
Set a new property.
|
boolean |
setProperty(CharSequence keyValue)
Set a property.
|
boolean |
setProperty(CharSequence keyValue,
boolean onlyNew)
Set property or make a new one.
|
Object |
setProperty(CharSequence key,
CharSequence value)
Enter a key/value pair.
|
void |
setRegion(CharSequence region)
Set the (preferred) region of this PropMap.
|
int |
size()
Number of entries.
|
String[] |
sortedKeys()
Fetch a sorted array of all keys.
|
StringBuilder |
sortedList(StringBuilder bastel)
Sorted multi line entries list.
|
void |
store(OutputStream output,
CharSequence startComment,
CharSequence encoding)
Storing all key value pairs to an output stream.
|
PropMap |
subSet(CharSequence prefix)
Make a subset of this key/value pairs by key prefix.
|
protected PropMapHelper.Entry |
substLang(String key,
String lang,
String regio,
String def)
Get a substitute entry for a key — nationalised.
|
String |
toString()
State as multi line String.
|
String |
value(CharSequence key)
Get the value for a key.
|
String |
valueLang(CharSequence key,
String defV)
Get value for a key — nationalised.
|
valuesfinalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAllprotected final ReentrantReadWriteLock.ReadLock rLock
protected final ReentrantReadWriteLock.WriteLock wLock
protected volatile PropMapHelper.Entry[] entries
protected volatile int hashMissMax
hashMissMax + 1 search
steps are necessary for this discovery.PropMap this value will normally
be 0. Experiments show (see hashQuality(StringBuilder)) that
values > 5 are quite improbable.Map is not intended for use cases
with a highly dynamic content, the value will not be decremented should
this be possible after a remove(). So after
a lot of removes an explicit
rehash(null, 0)
might be appropriate.hashQuality(StringBuilder),
hashMissSumprotected int hashMissSum
hashMissMax,
hashQuality(StringBuilder),
reHashesprotected int reHashes
rehash()s.
This is pure measurement.hashQuality(StringBuilder),
hashMissMaxpublic static final int VL_CL
11protected String language
getLanguage()protected String region
getRegion()public static final int FILE_LIST_LEN
25protected transient volatile PropMap.KeySet<CharSequence> internalKeySet
protected transient volatile AbstractSet<Map.Entry<CharSequence,String>> internalEntrySet
public static final String valStringMld
"de.frame4j.util.ProMap.Entry values must be CharSequences (or null)."public static final String keyStringMld
"de.frame4j.util.ProMap.Entry keys must be non empty (trimmed) Strings."public PropMap()
public PropMap(int startCap)
public final int size()
size in interface Map<CharSequence,String>size in class AbstractMap<CharSequence,String>public final boolean equals(Object o)
o is of type
PropMap, has the same size and for all
o's entries one own can be found that
is equal.PropMaps change in the proceeding this method's result
might reflect the new or the previous state.equals in interface Map<CharSequence,String>equals in class AbstractMap<CharSequence,String>public final int hashCode()
hashCode in interface Map<CharSequence,String>hashCode in class AbstractMap<CharSequence,String>public Object clone()
PropMap is made and returned. Original and
copy share the PropMapHelper.Entrys existing or contained
at the time of the call. Changing the value of a (mutable) entry effects
both; adding and removing effects only one. The first call to
deepIt() clones all shared mutable PropMapHelper.Entrys,
hence making the copy independent.Hashtable) low-cost.clone in class AbstractMap<CharSequence,String>deepIt()public final void deepIt()
cloned
PropMap replaces every mutable PropMapHelper.Entry by its
copy (using entry.clone()). This
makes the shallow clone() deep.clone()public final boolean isEmpty()
isEmpty in interface Map<CharSequence,String>isEmpty in class AbstractMap<CharSequence,String>Map.isEmpty()public final void clear()
clear in interface Map<CharSequence,String>clear in class AbstractMap<CharSequence,String>clear(int)public void clear(int startCap)
PropMap with a specified minimal
(stating) capacity.protected boolean remove(int i)
public final int indexOfKey(CharSequence key)
public final boolean containsKey(Object key)
containsKey in interface Map<CharSequence,String>containsKey in class AbstractMap<CharSequence,String>Map.containsKey(java.lang.Object)public String get(Object key)
containsKey(Object).get in interface Map<CharSequence,String>get in class AbstractMap<CharSequence,String>Map.get(java.lang.Object),
containsKey(Object)public final String value(CharSequence key)
get(Object), but with
a method signature better fitting this class' contract.Map.get(java.lang.Object)public final String getProperty(String name)
value(CharSequence). Its only purpose
is the compatibility to the late Properties
(facilitating the change of pedigree in some cases).public final String getString(CharSequence name)
name, the value of it being
a non empty String even after stripping surrounding white spaces
(from the value).getString(name, null).name - the key of the searched for property / entrygetString(CharSequence, String),
getInt(CharSequence, int),
getBoolean(CharSequence)public String getString(CharSequence key, String defV)
PropMap does not contain a property fitting
key (the parameter will be stripped from surrounding
white space before) the substitute defV will be returned.defV will be returned.key from this
PropMap
TextHelper.trimUq(value, defV) is returned.key - the name of the searched for property / entrydefV - the substitute for unavailable null or
(stripped) empty valuegetString(CharSequence),
getInt(CharSequence, int),
getBoolean(CharSequence),
TextHelper.trimUq(CharSequence, String)public PropMapHelper.Entry entry(CharSequence key)
key must be a non empty character sequence, even after stripping
surrounding white space.get(Object), value(CharSequence)
and all other entry / value getters *) delegate to this method. Hence it's
the only one to be overridden in inheriting classes, if the determination
of the value is less straightforward (e.g. by having to consult
substitute Maps or the like).containsValue(Object), containsKey(Object)
and PropMap.EntrySet.contains(Object) are exceptions; the
work alone.Map.get(java.lang.Object),
get(Object)public boolean containsValue(Object value)
containsValue in interface Map<CharSequence,String>containsValue in class AbstractMap<CharSequence,String>Map.containsValue(java.lang.Object)public final boolean getBoolean(CharSequence name)
name
exists in this PropMap, having a value of
"true", "wahr", "ja", "yes", "an" or "on".TextHelper.asBoolean(CharSequence) as true.name - the key of the searched for property / entrygetInt(),
getBoolean(CharSequence, boolean)public final boolean getBoolean(CharSequence name, boolean defV)
name here defV is
returned.asBoolean(value, defV) as a logical value. If that is feasible by
that method's rules that value is returned and defV
otherwise.public final int getInt(CharSequence name, int defV)
name here defV is
returned.asInt(value, defV) as a whole
number. If that is feasible by that method's rules that value is returned
and defV otherwise.name - the properties namedefV - default / substitute valuegetBoolean(CharSequence),
getLong(CharSequence, long),
TextHelper.asInt(CharSequence, int)public long getLong(CharSequence name, long defV)
name here defV is
returned.defV
otherwise.name - the properties namedefV - default / substitute valuegetBoolean(CharSequence),
getInt(CharSequence, int)public String remove(Object key)
key here null will be
returned.remove(int) only) null is returned also.remove in interface Map<CharSequence,String>remove in class AbstractMap<CharSequence,String>key - the key to the entry to be removedpublic String put(CharSequence key, String value) throws UnsupportedOperationException
TextHelperTextHelper.trimUq(CharSequence, String).
Otherwise an IllegalArgumentException is thrown.PropMapHelper.Entry for key, its
value will be changed, otherwise a new pair (key, value) will be made
and entered to this Map.put in interface Map<CharSequence,String>put in class AbstractMap<CharSequence,String>key - the new entry's keyvalue - the new value; may be nullUnsupportedOperationException - if the call hits an existing
entry with another value marked as immutableIllegalArgumentException - if the key supplied violates
PropMap's rulesput(de.frame4j.util.PropMapHelper.Entry)protected final String putImpl(String key, CharSequence value) throws UnsupportedOperationException
put(CharSequence, String) but without
checks; it's a internal helper for correct parameters.key - the new entry's keyvalue - the new value; may be nullUnsupportedOperationException - if the call hits an existing
entry with another value marked as immutableput(de.frame4j.util.PropMapHelper.Entry),
put(CharSequence, String)protected final void putNewImpl(String key, String value) throws UnsupportedOperationException
put(CharSequence, String) but without any checks and for a
really new entry only.key - the new entry's keyvalue - the new value; may be nullUnsupportedOperationException - if the call hits an existing
entry with another value marked as immutableput(de.frame4j.util.PropMapHelper.Entry)protected final void putNewImut(String key, String value) throws UnsupportedOperationException
put(CharSequence, String) but without any checks; internal
helper.key - the new entry's keyvalue - the new value; may be nullUnsupportedOperationException - if the call hits an existing
entry with another value marked as immutableput(de.frame4j.util.PropMapHelper.Entry),
put(CharSequence, String)public final Object setProperty(CharSequence key, CharSequence value)
put(CharSequence, String), better
called directly if value's type is String.public final String getProperty(CharSequence key, String defaultValue)
getString(CharSequence, String).Map.get(java.lang.Object),
get(Object),
value(CharSequence)public String getProperty(CharSequence key, int num, String defV)
key is null or empty or if num is < 0,
null is returned.key + num (in any of the forms
mentioned below) its value is returned even if empty.num in the range 0 to 9 and if key + num
above fails the same is tried with one leading zero ("name7"
e.g. and also "name07").num == 0 the "pure" property
key is searched for.defV is returned.key - the property's (pure) namenum - the property's index / number (>=0)defV - the default / substitute value for nothing or only null values
foundpublic String getProperty(CharSequence key, String pref1, String pref2, String defV)
key is null or empty null is returned.pref1 is not null and there is a property named
pref1.key its value is returned (also if it is empty).pref2.key
is searched for.key - the property's (pure) namepref1 - the first prefix to trypref2 - the second prefix to trydefV - the default / substitute value for nothing or only null values
foundpublic boolean getBoolean(CharSequence name, int num, boolean defV)
getProperty(name, num, null).
If that returns null, defV is returned.asBoolean(value, defV)
as logical value that will be returned.public int getInt(String name, int num, int defV)
getProperty(name, num, null).
If that returns null, defV is returned.asInt(value, defV)
as numerical value that will be returned.name - the property's (pure) namenum - the property's index / number (>=0)defV - the default / substitute value for nothing or only null values
foundgetBoolean(),
getLong(),
TextHelper.asInt(CharSequence, int)public final String valueLang(CharSequence key, String defV)
getLanguage()) and region
(getRegion()) codes are used in combination with key to
search for properties in the following order:substLang(key, lang, regio, defV),
so this behaviour or strategy could be changed in classes extending
PropMap.VL_CL) keys are returned very fast.protected PropMapHelper.Entry substLang(String key, String lang, String regio, String def)
valueLang(CharSequence, String) and may be overridden in
extending classes to implement further endeavours or other strategies
to get nationalised property values.key - non emptylang - two letter lower case language coderegio - two letter upper case region or country code
or ComVar.EMPTY_STRING if no region to be useddef - the default value; ignored in this implementation (the
parameter being only there for potential use in inheritors)public final String getLanguage()
setLanguage(CharSequence)public void setLanguage(CharSequence language)
TextHelper.checkLanguage(CharSequence, CharSequence).setRegion(CharSequence) and the first two taken as effective
argument to this method.language - new preferred languagegetLanguage()public final String getRegion()
setRegion(CharSequence)public void setRegion(CharSequence region)
TextHelper.checkRegion(CharSequence, CharSequence).region - new preferred region, null will be replacedgetRegion()protected void rehash(PropMapHelper.Entry newEnt, int ensCap)
newEnt at
the "hash right" spot.newEnt - null or until now not yet entered.ensCap - ordered minimal new capacity, if larger than beforepublic void rehash()
rehash(null, 0).public PropMapHelper.Entry put(PropMapHelper.Entry newEntry) throws UnsupportedOperationException
newEntry is not yet in this map
newEntry will be put in and null will be returned. Null will also
be returned if newEntry is null.UnsupportedOperationException.newEntry - an Entry object (according to the contract) or nullUnsupportedOperationException - if an immutable entry would
have to be replaced / modifiedput(CharSequence, String)public boolean add(CharSequence key, CharSequence value)
key is stripped from surrounding white space.
If (then) empty nothing happens and and false is returned.key is already in this Map it is not touched
and false is returned. Otherwise a new entry key/value is made and
entered. true is returned in that case.putIfAbsent(CharSequence, String).public String putIfAbsent(CharSequence key, String value)
putIfAbsent in interface ConcurrentMap<CharSequence,String>putIfAbsent in interface Map<CharSequence,String>put(CharSequence, String),
add(CharSequence, CharSequence)public boolean remove(Object key, Object value)
value as value. remove in interface ConcurrentMap<CharSequence,String>remove in interface Map<CharSequence,String>public String replace(CharSequence key, String value)
key only if that
entry is already in this map and it is not immutable.replace in interface ConcurrentMap<CharSequence,String>replace in interface Map<CharSequence,String>public boolean replace(CharSequence key, String oldValue, String newValue)
key only if that
entry is already in this map and it is not immutable and if its former
value id oldValue.replace in interface ConcurrentMap<CharSequence,String>replace in interface Map<CharSequence,String>public boolean setProperty(CharSequence keyValue)
getBooelan(),
getInt(),
setNewProperty(CharSequence)public boolean setNewProperty(CharSequence keyValue)
public final boolean setProperty(CharSequence keyValue, boolean onlyNew)
public boolean setNewProperty(CharSequence key, String value)
setProperty(),
setNewProperty(CharSequence)public void putAll(Map<? extends CharSequence,? extends String> map)
Map.AbstractMap with extra exploiting the cases where map is
of type PropMap or where map's EntrySet contains
PropMapHelper.Entrys.map is not a PropMap only those entries will be
transfered that fulfil this classes contract for values and keys.
key/value pairs of type CharSequence/Number,
CharSequence/Character or
CharSequence/Boolean will be transformed accordingly.putAll in interface Map<CharSequence,String>putAll in class AbstractMap<CharSequence,String>map - entries to be taken to this mapUnsupportedOperationException - if an existing immutable entry
would have to be changedpublic final StringBuilder hashQuality(StringBuilder bastel)
StringBuilder are two comment lines
(beginning with # ) describing the actual hash quality of this
PropMap object. For testing and debugging purposes.bastel - StringBuilder to append to. If non existing, it will be
made with a starting capacity of 133toString()public StringBuilder sortedList(StringBuilder bastel)
StringBuilder will be a multi-line list
sorted by keys (with at least one line per entry) of all entries
(PropMapHelper.Entry).bastel - StringBuilder to append to. If non existing, it will be
made with a starting capacity of size() * 43 + 122toString(),
hashQuality(StringBuilder)public final String toString()
PropMapHelper.Entry) will be returned.PropMap and by two empty
lines.toString in class AbstractMap<CharSequence,String>PropMapHelper.Entry.toString(),
hashQuality(StringBuilder),
sortedList(StringBuilder),
load(InputStream, CharSequence)public void load(InputStream input, CharSequence encoding) throws IOException
input - the stream to read the properties fromencoding - the stream's encoding (character set)IOException - stream or file problemsPropMapHelper.load(InputStream, CharSequence, Map),
PropMapHelper.store(Map, OutputStream, CharSequence, CharSequence),
Properties.load(InputStream),
Properties.store(java.io.OutputStream, java.lang.String),
store(OutputStream, CharSequence, CharSequence)public boolean load1(CharSequence fileName, CharSequence encoding) throws IllegalArgumentException, ClassCastException
PropMap object all properties (key/value pairs) parsable
from the text file FileName will be entered or modified
accordingly. See
PropMapHelper.load(InputStream, CharSequence, Map) for syntax
and all details.PropMap operations will be forwarded. That
will end the process.fileName will be recorded
as one of the files / resources loaded.fileName - the name of the text file to be parsed and loaded. If null
false will be returned.encoding - the file's or stream's encoding (character set)IllegalArgumentException - if put(String, String) will be so rejectedUnsupportedOperationException - if put(String, String) will be so rejectedClassCastException - if a key violates PropMap' contractload(InputStream, CharSequence),
PropMapHelper.load(InputStream, CharSequence, Map)public boolean load1(Class<?> cl, CharSequence fileName, CharSequence encoding) throws ClassCastException, UnsupportedOperationException
PropMap object all properties (key/value pairs) parsable
from the text file FileName will be entered or modified
accordingly. See
PropMapHelper.load(InputStream, CharSequence, Map) for syntax and
all details.cl. Used accordingly, this can have the effect of
getting the denoted text file as resource from the application's or
Frame4's (the framework's) .jar file. This is the best way of deploying
properties, (beans) settings and else as resources. If the .jar file is
signed, the protection against manipulation applies to the properties as
well as to the classes / code.PropMap operations will be forwarded. That
will end the process.fileName will be recorded
as one of the files / resources loaded.cl - the base class to relate resources to. If null false is returnedfileName - the name of the text file to be parsed and loaded. If null
false will be returned.encoding - the file's or stream's encoding (character set)IllegalArgumentException - if put(String, String) will be
so rejectedUnsupportedOperationException - if put(String, String)
will be so rejectedClassCastException - if a key violates PropMap' contractClassCastException - a key violates PropMap' contractload(InputStream, CharSequence),
PropMapHelper.load(InputStream, CharSequence, Map),
load1(CharSequence, CharSequence)public void store(OutputStream output, CharSequence startComment, CharSequence encoding) throws IOException
output - the stream to write the properties tostartComment - a describing comment to put at the beginencoding - the streams encoding (character set)IOException - when output problemsNullPointerException - when output or map are nullPropMapHelper.load(InputStream, CharSequence, Map),
PropMapHelper.store(Map, OutputStream, CharSequence, CharSequence),
Properties.load(java.io.InputStream),
Properties.store(java.io.OutputStream, java.lang.String),
load(InputStream, CharSequence)public PropMap subSet(CharSequence prefix)
prefix is null or empty this PropMap object itself is
returned (this).PropMap object will be made and filled
only with those entries, which's keys are longer than prefix and start
with it. Each new entry's key will be shortened by the given prefix.PropMap is of the type Prop, a Prop
object will be returned.prefix - the prefix for the properties to take inpublic final Properties asProperties(CharSequence filter)
Properties or a Dictionary object,
while really wanting any Map. This happens mainly in older APIs,
like in javax.mail but also in OSGI implementations.PropMap as a new Properties
object.value is null. A PropMap allows for
null values while a Properties container does not.filter - if (trimmed) not empty or null, it is used as a key filter
letting only those keys pass that start with filter (e.g. mail.)Properties object containing the
key/value pairs of this object; never null, but may be emptypublic final Set<CharSequence> keySet()
keySet in interface Map<CharSequence,String>keySet in class AbstractMap<CharSequence,String>public String[] sortedKeys()
keySet()public final Set<Map.Entry<CharSequence,String>> entrySet()
PropMap.EntrySet object
for this PropMap.Set.toArray() returns (every time) a new filled
PropMapHelper.Entry array.entrySet in interface Map<CharSequence,String>entrySet in class AbstractMap<CharSequence,String>