# Class DefaultCoordinateMetadata

Object
FormattableObject
DefaultCoordinateMetadata

All Implemented Interfaces:
  `Serializable`, `LenientComparable`, `Printable`

public class DefaultCoordinateMetadata extends FormattableObject implements LenientComparable, Serializable
Default implementation of metadata required to reference coordinates. Metadata include a coordinate reference system and the epoch at which the coordinates are valid. This default implementation provides Well-Known Text support. It is immutable and serializable if the CRS and epoch are also serializable.

## Future evolution

This class is expected to implement a `CoordinateMetadata` interface after the next GeoAPI release.

Since:
  1.5
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultCoordinateMetadata(CoordinateReferenceSystem crs, Temporal epoch)`
  Creates a new coordinate metadata.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final boolean`
  `equals(Object obj)`
  Compares this metadata with the given object for equality.
  `boolean`
  `equals(Object obj, ComparisonMode mode)`
  Compares this metadata with the given object for equality.
  `protected String`
  `formatTo(Formatter formatter)`
  Formats this metadata as a Well Known Text `CoordinateMetadata[…]` element.
  `Optional<Temporal>`
  `getCoordinateEpoch()`
  Returns the date at which coordinate tuples referenced to a dynamic CRS are valid.
  `CoordinateReferenceSystem`
  `getCoordinateReferenceSystem()`
  Returns the CRS in which the coordinate tuples are given.
  `int`
  `hashCode()`
  Returns a hash code value for this coordinate metadata.

  ### Methods inherited from class FormattableObject

  `print, toString, toString, toWKT`

  ### Methods inherited from class Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### DefaultCoordinateMetadata

    public DefaultCoordinateMetadata(CoordinateReferenceSystem crs, Temporal epoch)
    Creates a new coordinate metadata.
    Parameters:
      `crs` - the coordinate reference system (CRS) in which the coordinate tuples are given.
      `epoch` - date at which coordinate tuples are valid, or `null` if the CRS is not dynamic.
    Throws:
      `IllegalArgumentException` - if `epoch` is null while the CRS is dynamic or has a dynamic component.

- ## Method Details

  - ### getCoordinateReferenceSystem

    public CoordinateReferenceSystem getCoordinateReferenceSystem()
    Returns the CRS in which the coordinate tuples are given. Should never be null in principle, however this implementation does not enforce this restriction.
    Returns:
      the coordinate reference system (CRS) of coordinate tuples.

  - ### getCoordinateEpoch

    public Optional<Temporal> getCoordinateEpoch()
    Returns the date at which coordinate tuples referenced to a dynamic CRS are valid.
    Returns:
      epoch at which coordinate tuples are valid.

  - ### hashCode

    public int hashCode()
    Returns a hash code value for this coordinate metadata.
    Overrides:
      `hashCode` in class `Object`
    Returns:
      a hash code value.

  - ### equals

    public final boolean equals(Object obj)
    Compares this metadata with the given object for equality.
    Specified by:
      `equals` in interface `LenientComparable`
    Overrides:
      `equals` in class `Object`
    Parameters:
      `obj` - the object to compare with this metadata.
    Returns:
      whether the two objects are equal.
    See Also:
      - `ComparisonMode​.STRICT`

  - ### equals

    public boolean equals(Object obj, ComparisonMode mode)
    Compares this metadata with the given object for equality.
    Specified by:
      `equals` in interface `LenientComparable`
    Parameters:
      `obj` - the object to compare to `this`.
      `mode` - the strictness level of the comparison.
    Returns:
      `true` if both objects are equal.
    See Also:
      - `Utilities​.deepEquals(Object, Object, ComparisonMode)`

  - ### formatTo

    protected String formatTo(Formatter formatter)
    Formats this metadata as a Well Known Text `CoordinateMetadata[…]` element.
    Specified by:
      `formatTo` in class `FormattableObject`
    Parameters:
      `formatter` - the formatter where to format the inner content of this WKT element.
    Returns:
      `"CoordinateMetadata"`.
    See Also:
      - `FormattableObject​.toWKT()`
      - `FormattableObject​.toString()`