|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Properties
In java, java.util.Properties is not an Interface. Bracket Properties has one, which allows (among other things) for both a standard and a sorted implementation. The standard implementation is backed by a LinkedHashMap, which keeps insertion order intact. This is a critical issue for non-trivial use of Properties files. Properties is also the home to the static Factory, which is the supported way to instantiate a Bracket Properties object.
| Nested Class Summary | |
|---|---|
static class |
Properties.Factory
The default mode is the trivial memory mode, which is BasicToken. |
static class |
Properties.Mode
Mode is the available combinations of lexer and parser BasicToken - PropertiesLexer and PropertiesParser. |
| Method Summary | |
|---|---|
void |
clear()
remove all entries from the underlying map |
boolean |
containsKey(String key)
get(key) will throw a RuntimeException if the key does not exist. |
Date |
dateValue(String key)
Date value here is assumed to be a long |
Date |
dateValue(String key,
String format)
Just syntactical sugar to use a SimpleDateFormat |
String |
get(String key)
Get the value. |
List<String> |
getComments(String key)
Get the list of comments, return an empty list if none |
Map<String,ValueModel> |
getPropertyMap()
Can be used to get direct access to the Entry data structures |
char |
getSeparator(String key)
The char found in the parse, normally '=' |
Node |
getTree()
Get the properties as a tree of nodes. |
Node |
getTree(GroupParams params)
Get the properties as a tree of nodes with a selector a.b.c=something a.b.c.d=something else a.b.c.e.f=item a.b.c.e=item2 |
boolean |
hasValue(String key)
Returns true if the key exists and has a non-empty value |
int |
intValue(String key)
Coerce to an integer value. |
long |
longValue(String key)
Coerce to a long value. |
Properties |
merge(Properties props)
Overwrite existing keys with the new ones, keep those existing ones that don't collide This operation is non-destructive on the input does not concatenate comments |
Properties |
merge(Properties props,
boolean mergeComments)
Overwrite existing keys with the new ones, keep those existing ones that don't collide This operation is non-destructive on the input |
void |
put(String key,
String... values)
Add the key and value or values. |
int |
size()
Number of entries in the underlying map |
void |
synchronize(Node rootNode)
Cause a graph to become the contents of the properties file. |
| Method Detail |
|---|
Map<String,ValueModel> getPropertyMap()
String get(String key)
key -
int intValue(String key)
key -
long longValue(String key)
key -
Date dateValue(String key)
key -
Date dateValue(String key,
String format)
throws ParseException
key - format -
ParseExceptionNode getTree()
Get the properties as a tree of nodes. For example,
a.b.c=something
a.b.c.d=something else
looks like
a
b
c - something
d - something else
This method is identical in results to getTree(regex) where the regex
is "\\.". That is, the separator token in the key is a full stop
Obviously this works better if your keys are delimited by dot characters
Node getTree(GroupParams params)
Get the properties as a tree of nodes with a selector a.b.c=something a.b.c.d=something else a.b.c.e.f=item a.b.c.e=item2
List<String> getComments(String key)
key -
char getSeparator(String key)
key -
void put(String key,
String... values)
key - values - int size()
void clear()
boolean containsKey(String key)
get(key) will throw a RuntimeException if the key does not exist. This method can be used to test for a key prior to calling get(). Returns true if the underlying map has this key
key -
boolean hasValue(String key)
key -
Properties merge(Properties props)
props -
Properties merge(Properties props,
boolean mergeComments)
props -
void synchronize(Node rootNode)
rootNode -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||