public class BasicValueModel extends Object implements ValueModel
Representation of properties values which accounts better for the actual complexity of a potential properties value. We consider comments above the key/value pair to be a part of the value. This is not really correct, and they should probably be associated with the key, but it generally works because there is a one to many relation between a key/value pair and a set of comments. It is also nice to keep a key as a simple String data type. Only comments above the key/value pair are considered part of the comment set. This is an arbitrary determination, but it places a very light burden on a programmer and it seems a reasonable convention. It means comments at the end (past any key) may potentially be discarded
| Modifier and Type | Field and Description |
|---|---|
protected List<String> |
comments |
(package private) static String |
lineSeparator |
protected char |
separator |
private static long |
serialVersionUID |
protected List<String> |
values |
| Constructor and Description |
|---|
BasicValueModel() |
BasicValueModel(char sep,
String... value) |
BasicValueModel(Comment comment,
char sep,
String... value) |
BasicValueModel(Comment comment,
String... value) |
BasicValueModel(List<String> comments,
List<String> values) |
BasicValueModel(String... value) |
| Modifier and Type | Method and Description |
|---|---|
void |
addComment(String comment) |
void |
addValue(String value) |
String |
asKeyValueRep(String key)
Output a reasonable representation of what the text for this key value pair would look like
|
void |
clearComments() |
boolean |
equals(Object obj) |
List<String> |
getComments() |
char |
getSeparator() |
String |
getValue() |
List<String> |
getValues() |
int |
hashCode() |
void |
setSeparator(char separator) |
String |
toString() |
String |
toXML(int spaces)
As of version 1.3.2, will emit ISO-8859-1 if Compatibility mode is in use
Otherwise, UTF-8
|
protected String |
toXMLCompatibilityMode(int spaces)
Write in ISO-8859-1 with unicode escapes
|
private static final long serialVersionUID
static final String lineSeparator
protected char separator
public BasicValueModel()
public BasicValueModel(String... value)
public BasicValueModel(char sep,
String... value)
public char getSeparator()
getSeparator in interface ValueModelpublic void setSeparator(char separator)
public List<String> getComments()
getComments in interface ValueModelpublic List<String> getValues()
getValues in interface ValueModelpublic void addValue(String value)
public void addComment(String comment)
public void clearComments()
public String getValue()
getValue in interface ValueModelpublic String asKeyValueRep(String key)
ValueModelasKeyValueRep in interface ValueModelpublic String toXML(int spaces)
toXML in interface ValueModelprotected String toXMLCompatibilityMode(int spaces)
spaces - Copyright © 2011-2014 David R. Smith. All Rights Reserved.