org.geotools.parameter
Class ParameterWriter

Object
  extended by Writer
      extended by FilterWriter
          extended by ParameterWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable

public class ParameterWriter
extends FilterWriter

Format parameter descriptors or parameter values in a tabular format. This writer assumes a monospaced font and an encoding capable to provide drawing box characters (e.g. unicode).

Since:
2.1
Author:
Martin Desruisseaux
Module:
modules/library/referencing (gt-referencing.jar)

Field Summary
 
Fields inherited from class FilterWriter
out
 
Fields inherited from class Writer
lock
 
Constructor Summary
ParameterWriter()
          Creates a new formatter writting parameters to the default output stream.
ParameterWriter(Writer out)
          Creates a new formatter writting parameters to the specified output stream.
 
Method Summary
 void format(OperationMethod operation)
          Prints the elements of an operation to the output stream.
 void format(ParameterDescriptorGroup descriptor)
          Prints the elements of a descriptor group to the output stream.
 void format(ParameterValueGroup values)
          Prints the elements of a parameter group to the output stream.
protected  String formatValue(Object value)
          Format the specified value as a string.
 Locale getLocale()
          Returns the current locale.
static void print(OperationMethod operation)
          Prints the elements of an operation to the default output stream.
static void print(ParameterDescriptorGroup descriptor)
          Prints the elements of a descriptor group to the default output stream.
static void print(ParameterValueGroup values)
          Prints the elements of a parameter group to the default output stream.
 void setLocale(Locale locale)
          Set the locale to use for table formatting.
 void summary(Collection<? extends IdentifiedObject> parameters, Set<String> scopes)
          Formats a summary of a collection of identified objects.
 
Methods inherited from class FilterWriter
close, flush, write, write, write
 
Methods inherited from class Writer
append, append, append, write, write
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParameterWriter

public ParameterWriter()
Creates a new formatter writting parameters to the default output stream.


ParameterWriter

public ParameterWriter(Writer out)
Creates a new formatter writting parameters to the specified output stream.

Method Detail

print

public static void print(OperationMethod operation)
Prints the elements of an operation to the default output stream. This is a convenience method for new ParameterWriter().format(operation).


print

public static void print(ParameterDescriptorGroup descriptor)
Prints the elements of a descriptor group to the default output stream. This is a convenience method for new ParameterWriter().format(descriptor).


print

public static void print(ParameterValueGroup values)
Prints the elements of a parameter group to the default output stream. This is a convenience method for new ParameterWriter().format(values).


format

public void format(OperationMethod operation)
            throws IOException
Prints the elements of an operation to the output stream.

Parameters:
operation - The operation method to format.
Throws:
IOException - if an error occured will writing to the stream.

format

public void format(ParameterDescriptorGroup descriptor)
            throws IOException
Prints the elements of a descriptor group to the output stream.

Parameters:
descriptor - The descriptor group to format.
Throws:
IOException - if an error occured will writing to the stream.

format

public void format(ParameterValueGroup values)
            throws IOException
Prints the elements of a parameter group to the output stream.

Parameters:
values - The parameter group to format.
Throws:
IOException - if an error occured will writing to the stream.

summary

public void summary(Collection<? extends IdentifiedObject> parameters,
                    Set<String> scopes)
             throws IOException
Formats a summary of a collection of identified objects. The summary contains the identifier name and alias aligned in a table.

Parameters:
parameters - The collection of parameters to format.
scopes - The set of scopes to include in the table, of null for all of them. A restricted a set will produce a table with less columns.
Throws:
IOException - if an error occured will writing to the stream.

getLocale

public Locale getLocale()
Returns the current locale. Newly constructed ParameterWriter use the system default.


setLocale

public void setLocale(Locale locale)
Set the locale to use for table formatting.


formatValue

protected String formatValue(Object value)
Format the specified value as a string. This method is automatically invoked by format(...) methods. The default implementation format Number, Date and Angle object according the current locale. This method can been overridden if more objects need to be formatted in a special way.

Parameters:
value - the value to format.
Returns:
The value formatted as a string.


Copyright © 1996-2009 Geotools. All Rights Reserved.