org.geotoolkit.parameter
Class AbstractParameter

Object
  extended by FormattableObject
      extended by AbstractParameter
All Implemented Interfaces:
Serializable, Cloneable, Formattable, GeneralParameterValue
Direct Known Subclasses:
FloatParameter, Parameter, ParameterGroup

public abstract class AbstractParameter
extends FormattableObject
implements GeneralParameterValue, Serializable, Cloneable

Abstract parameter value or group of parameter values.

Since:
2.0
Version:
3.00
Author:
Martin Desruisseaux (IRD)
See Also:
AbstractParameterDescriptor, Serialized Form
Module:
referencing/geotk-referencing (download)    View source code for this class

Field Summary
 
Fields inherited from class FormattableObject
EPSG, GEOTIFF, INTERNAL, OGC, SINGLE_LINE
 
Constructor Summary
protected AbstractParameter(GeneralParameterDescriptor descriptor)
          Constructs a parameter value from the specified descriptor.
 
Method Summary
 AbstractParameter clone()
          Returns a copy of this parameter value or group.
 boolean equals(Object object)
          Compares the specified object with this parameter for equality.
 String formatWKT(Formatter formatter)
          Formats the inner part of this parameter as Well Known Text (WKT).
 GeneralParameterDescriptor getDescriptor()
          Returns the abstract definition of this parameter or group of parameters.
 int hashCode()
          Returns a hash value for this parameter.
 String toString()
          Returns a string representation of this parameter.
protected  void write(TableWriter table)
          Writes the content of this parameter to the specified table.
 
Methods inherited from class FormattableObject
getDefaultIndentation, print, setDefaultIndentation, toWKT, toWKT, toWKT
 
Methods inherited from class Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractParameter

protected AbstractParameter(GeneralParameterDescriptor descriptor)
Constructs a parameter value from the specified descriptor.

Parameters:
descriptor - The abstract definition of this parameter or group of parameters.
Method Detail

getDescriptor

public GeneralParameterDescriptor getDescriptor()
Returns the abstract definition of this parameter or group of parameters.

Specified by:
getDescriptor in interface GeneralParameterValue

clone

public AbstractParameter clone()
Returns a copy of this parameter value or group.

Specified by:
clone in interface GeneralParameterValue
Overrides:
clone in class Object

equals

public boolean equals(Object object)
Compares the specified object with this parameter for equality.

Overrides:
equals in class Object
Parameters:
object - The object to compare to this.
Returns:
true if both objects are equal.

hashCode

public int hashCode()
Returns a hash value for this parameter. This value doesn't need to be the same in past or future versions of this class.

Overrides:
hashCode in class Object

toString

public final String toString()
Returns a string representation of this parameter. The default implementation delegates the work to write(TableWriter), which should be overridden by subclasses.

Overrides:
toString in class FormattableObject

write

protected void write(TableWriter table)
              throws IOException
Writes the content of this parameter to the specified table. This method provides a more convenient way to align the values than overriding the toString() method. The table columns are defined as below:

  1. The parameter name
  2. The separator
  3. The parameter value

The default implementation is suitable for most cases. However, subclasses are free to override this method with the following idiom:

table.write("parameter name");
table.nextColumn()
table.write('=');
table.nextColumn()
table.write("parameter value");
table.nextLine()

Parameters:
table - The table where to format the parameter value.
Throws:
IOException - if an error occurs during output operation.

formatWKT

public String formatWKT(Formatter formatter)
Formats the inner part of this parameter as Well Known Text (WKT). This method doesn't need to be overridden, since the formatter already know how to format parameters.

Specified by:
formatWKT in interface Formattable
Overrides:
formatWKT in class FormattableObject
Parameters:
formatter - The formatter to use.
Returns:
The name of the WKT element type (e.g. "GEOGCS").
See Also:
FormattableObject.toWKT(), FormattableObject.toString()


Copyright © 2009-2011 Geotoolkit.org. All Rights Reserved.