|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.text.Format net.sf.fikin.pojostate.StateFormat net.sf.fikin.pojostate.format.PropertiesStateFormat
public class PropertiesStateFormat
Format a State
object in properties-like fashion.
Output format is like:
UI name=UI value
#UI description
...
It recognizes most stream and writer interfaces, @see #format(Object, Object), created on Jul 6, 2005
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.text.Format |
---|
java.text.Format.Field |
Constructor Summary | |
---|---|
PropertiesStateFormat()
|
Method Summary | |
---|---|
void |
format(java.lang.Object obj,
java.lang.Object out)
It does recognize following output object types:
java.io.BufferedOutputStream
java.io.BufferedWriter
java.io.OutputStream
java.io.Writer
java.io.PrintStream
java.io.PrintWriter
For all other types raises an exception. |
java.lang.StringBuffer |
format(java.lang.Object obj,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Format the object to a string and append it to toAppendTo . |
void |
format(State state,
java.io.PrintWriter out)
Print the State object to string. |
java.lang.Object |
parseObject(java.lang.String source,
java.text.ParsePosition pos)
a dummy implementation as typically this is a not supported method |
void |
printFooter(State state,
java.io.PrintWriter out)
empty, part of the prototype format(State, PrintWriter) algorithm. |
void |
printHeader(State state,
java.io.PrintWriter out)
empty, part of the prototype format(State, PrintWriter) algorithm. |
void |
printProperty(Property property,
java.io.PrintWriter out)
Prints the Property object in properties-like fashion:
UI name=UI value
#UI description
|
Methods inherited from class java.text.Format |
---|
clone, format, formatToCharacterIterator, parseObject |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PropertiesStateFormat()
Method Detail |
---|
public java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
toAppendTo
.
The execution fails to
format
State state, new StringWriter()
format
in class java.text.Format
obj
- toAppendTo
- pos
-
public void format(java.lang.Object obj, java.lang.Object out) throws java.lang.IllegalArgumentException, java.io.IOException
java.io.BufferedOutputStream
java.io.BufferedWriter
java.io.OutputStream
java.io.Writer
java.io.PrintStream
java.io.PrintWriter
For all but java.io.PrintWriter
it provides with dynamic
object decoration in the way of new PrintWriter( (XXX)out )
and delegates the formating to format(State, PrintWriter)
.
Output stream is not closed!
The caller is expected to take care of this.
format
in class StateFormat
obj
- The object to formatout
- The object to print the text to directly.
java.lang.IllegalArgumentException
- if the Format cannot format the given
object or out object type is not any of the aforementioned.
java.io.IOException
- in case when writting to output object failedpublic void format(State state, java.io.PrintWriter out) throws java.io.IOException
State
object to string.
This is a prototype method which does call in order printHeader()
,
iterate over all printProperty()
and then calls
printFooter()
.
Output stream is not closed!
state
- out
-
java.io.IOException
public void printHeader(State state, java.io.PrintWriter out) throws java.io.IOException
format(State, PrintWriter)
algorithm.
state
- out
-
java.io.IOException
public void printFooter(State state, java.io.PrintWriter out) throws java.io.IOException
format(State, PrintWriter)
algorithm.
state
- out
-
java.io.IOException
public void printProperty(Property property, java.io.PrintWriter out) throws java.io.IOException
Property
object in properties-like fashion:
UI name=UI value
#UI description
property
- out
-
java.io.IOException
public java.lang.Object parseObject(java.lang.String source, java.text.ParsePosition pos)
parseObject
in class java.text.Format
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |