Package org.apache.sis.internal.util
Class PropertyFormat
java.lang.Object
org.apache.sis.io.LineAppender
org.apache.sis.internal.util.PropertyFormat
- All Implemented Interfaces:
Flushable,Appendable,Localized
Creates string representation of property values of unknown type.
Tabulations are replaced by spaces, and line feeds can optionally
be replaced by the Pilcrow character.
Subclasses need to override
Localized.getLocale(), and should also override toString(Object).- Since:
- 1.1
- Version:
- 1.2
- Author:
- Martin Desruisseaux (Geomatys)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FormatThe format for the column in process of being written.protected final AppendableThe underlying character output stream or buffer. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPropertyFormat(Appendable out) Creates a new instance which will write to the given appendable. -
Method Summary
Modifier and TypeMethodDescriptionappend(CharSequence sequence) Appends the specified character sequence.final voidappendValue(Object value) Appends a textual representation of the given value.protected StringInvoked after formatting a text that could be anything.toString()Returns the content of thisAppendableas a string if possible, or the localized "Unavailable content" string otherwise.protected StringInvoked byPropertyFormatfor formatting a value which has not been recognized as one of the types to be handled in a special way.Methods inherited from class org.apache.sis.io.LineAppender
append, append, clear, flush, getLineSeparator, getMaximalLineLength, getTabulationWidth, isTabulationExpanded, onLineBegin, setLineSeparator, setMaximalLineLength, setTabulationExpanded, setTabulationWidth
-
Field Details
-
columnFormat
The format for the column in process of being written. This is a format to use for the column as a whole. This field is updated for every new column to write. May benullif the format is unspecified. -
out
The underlying character output stream or buffer.
-
-
Constructor Details
-
PropertyFormat
Creates a new instance which will write to the given appendable.- Parameters:
out- where to format the objects.
-
-
Method Details
-
appendValue
Appends a textual representation of the given value.- Parameters:
value- the value to format (may benull).- Throws:
IOException- if an error occurred while writing the value.
-
toString
Invoked byPropertyFormatfor formatting a value which has not been recognized as one of the types to be handled in a special way. Some of the types handled in a special way areInternationalString,,invalid reference
ControlledVocabularyEnum,Type,Locale,TimeZone,Charset,Currency,Record,Iterableand arrays. Other types should be handled by this method. In particular,Number,DateandAngleare not handled by default by thisPropertyFormatclass and should be handled here.- Parameters:
value- the value to format (nevernull).- Returns:
- the formatted value.
-
freeText
Invoked after formatting a text that could be anything. It current version, it includes all kinds ofCharSequenceincludingInternationalString, together withObject.toString()values computed by the defaulttoString(Object)implementation. The defaultfreeText(…)implementation removes white space and control characters. Subclasses can override for example for making a text shorter.- Parameters:
text- the free text, ornull.- Returns:
- the text to append.
-
append
Appends the specified character sequence. The default implementation delegates toAppendable.append(CharSequence, int, int).- Specified by:
appendin interfaceAppendable- Parameters:
sequence- the character sequence to append, ornull.- Returns:
- a reference to this
Appendable. - Throws:
IOException- if an I/O error occurred.
-
toString
Returns the content of thisAppendableas a string if possible, or the localized "Unavailable content" string otherwise.
-