asia.redact.bracket.properties
Class BasicValueModel
java.lang.Object
asia.redact.bracket.properties.BasicValueModel
- All Implemented Interfaces:
- ValueModel
- Direct Known Subclasses:
- ImmutableValueModel
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
- Author:
- Dave
lineSeparator
static final String lineSeparator
comments
protected final List<String> comments
values
protected final List<String> values
separator
protected char separator
BasicValueModel
public BasicValueModel()
BasicValueModel
public BasicValueModel(String... value)
BasicValueModel
BasicValueModel(List<String> comments,
List<String> values)
hashCode
public int hashCode()
- Overrides:
hashCode in class Object
equals
public boolean equals(Object obj)
- Overrides:
equals in class Object
getSeparator
public char getSeparator()
- Specified by:
getSeparator in interface ValueModel
setSeparator
public void setSeparator(char separator)
getComments
public List<String> getComments()
- Specified by:
getComments in interface ValueModel
getValues
public List<String> getValues()
- Specified by:
getValues in interface ValueModel
addValue
public void addValue(String value)
addComment
public void addComment(String comment)
clearComments
public void clearComments()
getValue
public String getValue()
- Specified by:
getValue in interface ValueModel
toString
public String toString()
- Overrides:
toString in class Object
toXML
public String toXML(int spaces)
- As of version 1.3.2, will emit ISO-8859-1 if Compatibility mode is in use
Otherwise, UTF-8
- Specified by:
toXML in interface ValueModel
toXMLCompatibilityMode
protected String toXMLCompatibilityMode(int spaces)
- Write in ISO-8859-1 with unicode escapes
- Parameters:
spaces -
- Returns:
Copyright © 2011-2013 David R. Smith. All Rights Reserved.