# Class DefaultObjectDomain

Object
FormattableObject
DefaultObjectDomain

All Implemented Interfaces:
  `Serializable, LenientComparable, Printable`

public class DefaultObjectDomain extends FormattableObject implements LenientComparable, Serializable
Scope and domain of validity of a CRS-related object. Those two properties are mandatory according ISO 19111. If a property is unspecified (by passing `null` to the constructor), then this class substitutes the null value by a "not known" text in an object implementing the `NilObject` interface with `NilReason​.UNKNOWN`. The use of "not known" text is an ISO 19111 recommendation.
Note on International Standard versions
This class is derived from a new type defined in the ISO 19111 international standard published in 2019, while GeoAPI 3.0 is based on the version published in 2007. Consequently this implementation class does not yet implement a GeoAPI interface, but is expected to do so after the next GeoAPI releases. When the interface will become available, all references to this implementation class in Apache SIS will be replaced be references to the `ObjectDomain` interface.

## Immutability and thread safety

This class is immutable and thus thread-safe if the property values given to the constructor are also immutable.

Since:
  1.4
See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final Extent`
  `domainOfValidity`
  Area for which the object is valid.
  `protected final InternationalString`
  `scope`
  Description of domain of usage, or limitations of usage, for which the object is valid.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultObjectDomain(InternationalString scope, Extent domainOfValidity)`
  Creates a new domain with the given scope and extent.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final boolean`
  `equals(Object object)`
  Compares the specified object with this object for equality.
  `boolean`
  `equals(Object object, ComparisonMode mode)`
  Compares this object system with the specified object for equality.
  `protected String`
  `formatTo(Formatter formatter)`
  Formats the inner part of the Well Known Text (WKT) representation for this object.
  `Extent`
  `getDomainOfValidity()`
  Returns the spatial and temporal extent in which this object is valid.
  `InternationalString`
  `getScope()`
  Returns a description of usage, or limitations of usage, for which this object is valid.
  `int`
  `hashCode()`
  Returns a hash code value for this domain.

  ### Methods inherited from class FormattableObject

  `print, toString, toString, toWKT`

  ### Methods inherited from class Object

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

- ## Field Details

  - ### scope

    protected final InternationalString scope
    Description of domain of usage, or limitations of usage, for which the object is valid. This is `null` (i.e. is not replaced by the "not known" text) if the value given to the constructor was null.
    See Also:
      - `getScope()`

  - ### domainOfValidity

    protected final Extent domainOfValidity
    Area for which the object is valid. This is `null` (i.e. is not replaced by the "not known" text) if the value given to the constructor was null.
    See Also:
      - `getDomainOfValidity()`

- ## Constructor Details

  - ### DefaultObjectDomain

    public DefaultObjectDomain(InternationalString scope, Extent domainOfValidity)
    Creates a new domain with the given scope and extent. If any value is `null`, the text will be set to "not known" (potentially localized). The "not known" text is standardized by ISO 19111 for the scope.
    Parameters:
      `scope` - description of domain of usage, or limitations of usage.
      `domainOfValidity` - area for which the object is valid.

- ## Method Details

  - ### getScope

    public InternationalString getScope()
    Returns a description of usage, or limitations of usage, for which this object is valid. If no scope was specified to the constructor, then this method returns "not known" in an instance implementing the `NilObject` interface with `NilReason​.UNKNOWN`.
    Returns:
      the domain of usage.

  - ### getDomainOfValidity

    public Extent getDomainOfValidity()
    Returns the spatial and temporal extent in which this object is valid. If no extent was specified to the constructor, then this method returns "not known" in an instance implementing the `NilObject` interface with `NilReason​.UNKNOWN`.
    Returns:
      the area or time frame of usage.

  - ### equals

    public final boolean equals(Object object)
    Compares the specified object with this object for equality. This method is implemented as below (omitting assertions):

        return equals(other, ComparisonMode.STRICT);

    Subclasses shall override `equals(Object, ComparisonMode)` instead of this method.
    Specified by:
      `equals` in interface `LenientComparable`
    Overrides:
      `equals` in class `Object`
    Parameters:
      `object` - the other object (may be `null`).
    Returns:
      `true` if both objects are equal.
    See Also:
      - `ComparisonMode​.STRICT`

  - ### equals

    public boolean equals(Object object, ComparisonMode mode)
    Compares this object system with the specified object for equality.
    Specified by:
      `equals` in interface `LenientComparable`
    Parameters:
      `object` - 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)`

  - ### hashCode

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

  - ### formatTo

    protected String formatTo(Formatter formatter)
    Formats the inner part of the Well Known Text (WKT) representation for this object. The default implementation writes the following elements:
    - The object scope.
    - The geographic description of the domain of validity.
    - The geographic bounding box of the domain of validity.
    Specified by:
      `formatTo` in class `FormattableObject`
    Parameters:
      `formatter` - the formatter where to format the inner content of this WKT element.
    Returns:
      the CamelCase keyword for the WKT element, or `null` if unknown.
    See Also:
      - `FormattableObject​.toWKT()`
      - `FormattableObject​.toString()`