|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractMap org.netbeans.spi.project.support.ant.EditableProperties
Similar to Properties
but designed to retain additional
information needed for safe hand-editing.
Useful for various *.properties in a project:
Collections#synchronizedMap
.
Nested Class Summary |
Nested classes inherited from class java.util.Map |
Map.Entry |
Constructor Summary | |
EditableProperties()
Creates empty instance which items will not be sorted by default. |
|
EditableProperties(boolean alphabetize)
Creates empty instance. |
|
EditableProperties(Map map)
Creates instance from an existing map. |
Method Summary | |
Object |
clone()
|
EditableProperties |
cloneProperties()
Create an exact copy of this properties object. |
Set |
entrySet()
Returns a set view of the mappings ordered according to their file position. |
String[] |
getComment(String key)
Returns comment associated with the property. |
String |
getProperty(String key)
Convenience method to get a property as a string. |
void |
load(InputStream stream)
Load properties from a stream. |
Object |
put(Object key,
Object value)
|
void |
setComment(String key,
String[] comment,
boolean separate)
Create comment for the property. |
String |
setProperty(String key,
String value)
Convenience method to set a property. |
String |
setProperty(String key,
String[] value)
Sets a property to a value broken into segments for readability. |
void |
store(OutputStream stream)
Store properties to a stream. |
Methods inherited from class java.util.AbstractMap |
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public EditableProperties()
public EditableProperties(boolean alphabetize)
alphabetize
- alphabetize new items according to key or notpublic EditableProperties(Map map)
map
- a map from String to StringMethod Detail |
public Set entrySet()
AbstractMap.entrySet()
for more dertails.
public void load(InputStream stream) throws IOException
stream
- an input stream
IOException
- if the contents are malformed or the stream could not be readpublic void store(OutputStream stream) throws IOException
stream
- an output stream
IOException
- if the stream could not be written topublic Object put(Object key, Object value)
public String getProperty(String key)
AbstractMap.get(java.lang.Object)
but has the correct return type.
key
- a property name; cannot be null nor empty
public String setProperty(String key, String value)
put(java.lang.Object, java.lang.Object)
but has the correct argument types.
(Slightly slower however.)
key
- a property name; cannot be null nor emptyvalue
- the desired value; cannot be null
public String setProperty(String key, String[] value)
setProperty(String,String)
with the difference that each item
will be stored on its own line of text. getProperty(java.lang.String)
will simply concatenate
all the items into one string, so generally separators
(such as : for path-like properties) must be included in
the items (for example, at the end of all but the last item).
key
- a property name; cannot be null nor emptyvalue
- the desired value; cannot be null; can be empty array
public String[] getComment(String key)
key
- a property name; cannot be null nor empty
public void setComment(String key, String[] comment, boolean separate)
key
- a property name; cannot be null nor emptycomment
- lines of comment which will be written just above
the property; no reformatting; comment lines must start with
comment delimiter; cannot be null; cannot be emty arrayseparate
- whether the comment should be separated from previous
item by empty linepublic Object clone()
public EditableProperties cloneProperties()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |