|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsbrt.shell.text.AbstractListFormat<E>
E
- the type of element.public abstract class AbstractListFormat<E>
This abstract class is a skeleton implementation of ListFormat. A concrete class with a defined format can be created by simply overriding the constructor of this class.
Constructor Summary | |
---|---|
AbstractListFormat(java.lang.String delimiter,
java.util.regex.Pattern regex,
Formatter<E> elementFormatter,
Parser<E> elementParser)
Constructs a new list format from the provided arguments. |
|
AbstractListFormat(java.lang.String delimiter,
java.util.regex.Pattern regex,
SimpleFormat<E> elementFormat)
Constructs a new list format from the provided arguments. |
Method Summary | |
---|---|
java.lang.String |
format(java.util.List<? extends E> c)
Returns a formatted string representation of the provided collection. |
java.lang.String |
getDelimiter()
Returns the delimiter used to separate elements when producing a formatted string. |
Formatter<E> |
getElementFormatter()
Returns the formatter for the elements of this LinkedHashSet format. |
Parser<E> |
getElementParser()
Returns the parser for the elements of this set format. |
java.util.regex.Pattern |
getRegex()
Returns the regular expression used to separate elements when parsing a formatted string. |
java.util.List<E> |
parse(java.lang.String list)
Parses the provided string and returns its corresponding collection of elements as a list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface sbrt.shell.text.Formatter |
---|
format |
Constructor Detail |
---|
public AbstractListFormat(java.lang.String delimiter, java.util.regex.Pattern regex, SimpleFormat<E> elementFormat)
delimiter
- the delimiter used to separate elements of lists when
producing a formatted string representation.regex
- the regular expression used to parse a string representation
of a list with this format. The method call
regex.split(String)
should return an array containing
the string representation of the elements of the provided list
string.elementFormat
- the format used for elements the of lists with this format.
java.lang.NullPointerException
- if any provided argument is null
.public AbstractListFormat(java.lang.String delimiter, java.util.regex.Pattern regex, Formatter<E> elementFormatter, Parser<E> elementParser)
delimiter
- the delimiter used to separate elements of lists when
producing a formatted string representation.regex
- the regular expression used to parse a string representation
of a list with this format. The method call
regex.split(String)
should return an array containing
the string representation of the elements of the provided list
string.elementFormatter
- the formatter used for elements the
of lists with this format.elementParser
- the parser used for elements the
of lists with this format.
java.lang.NullPointerException
- if any provided argument is null
.Method Detail |
---|
public java.lang.String getDelimiter()
public java.util.regex.Pattern getRegex()
public Formatter<E> getElementFormatter()
LinkedHashSet
format.
getElementFormatter
in interface ListFormat<E>
LinkedHashSet
format.public Parser<E> getElementParser()
getElementParser
in interface ListFormat<E>
public java.lang.String format(java.util.List<? extends E> c)
format
in interface ListFormat<E>
c
- the collection to be formatted.
public java.util.List<E> parse(java.lang.String list)
parse
in interface ListFormat<E>
parse
in interface Parser<java.util.List<E>>
list
- the string to be parsed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |