org.geotoolkit.metadata
Class ValueRestriction

Object
  extended by ValueRestriction
All Implemented Interfaces:
Serializable

@Immutable
public class ValueRestriction
extends Object
implements Serializable

Restrictions that apply on a metadata property. Instances of ValueRestriction are created only for properties having at least one non-null obligation, range or valid values enumeration restriction.

For a given metadata instances (typically an AbstractMetadata subclasses, but other types are allowed), instances of ValueRestriction are obtained indirectly by the MetadataStandard.asRestrictionMap(...) method.

ValueRestriction objects do not contain the type of values (except indirectly through Range.getElementType() or CheckedCollection.getElementType()) because this particular requirement is specified by other means, like MetadataStandard.asTypeMap(...).

Since:
3.04
Version:
3.05
Author:
Martin Desruisseaux (Geomatys)
See Also:
MetadataStandard#asRestrictionMap(Object, NullValuePolicy, KeyNamePolicy), Serialized Form
Module:
metadata/geotk-metadata (download)    View source code for this class

Field Summary
 Obligation obligation
          Whatever the property is mandatory or forbidden, or null if there is no known restriction.
 NumberRange<?> range
          The range of valid values, or null if the values are not restricted by a range.
 Set<?> validValues
          An enumeration of valid values, or null if the values are not restricted that way.
 
Constructor Summary
protected ValueRestriction(Obligation obligation, NumberRange<?> range, Set<?> validValues)
          Creates a new Restriction instance.
 
Method Summary
 boolean equals(Object other)
          Compares the given object with this restriction for equality.
 int hashCode()
          Returns a hash code value for this restriction.
 String toString()
          Returns a string representation of this restriction.
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

obligation

public final Obligation obligation
Whatever the property is mandatory or forbidden, or null if there is no known restriction.

The optional obligation is considered equivalent to an absence of restriction and is replaced by null if MetadataStandard.asRestrictionMap(...) has been invoked with a metadata instance, since the metadata is not violating this obligation. If asRestrictionMap(...) has been invoked with a Class argument instead, then the obligation is provided verbatism since we are not testing violation of restrictions.


range

public final NumberRange<?> range
The range of valid values, or null if the values are not restricted by a range. This restriction is typically exclusive with the enumeration of valid values (i.e. only one of range or validValues is non-null), but this is not enforced by this ValueRestriction class.


validValues

public final Set<?> validValues
An enumeration of valid values, or null if the values are not restricted that way. This restriction is typically exclusive with the range of valid values (i.e. only one of range or validValues is non-null), but this is not enforced by this ValueRestriction class.

Since:
3.05
Constructor Detail

ValueRestriction

protected ValueRestriction(Obligation obligation,
                           NumberRange<?> range,
                           Set<?> validValues)
Creates a new Restriction instance. This constructor does not clone any argument; this is caller responsibility to provide immutable instance of them, especially validValues.
Note: This constructor is not public in order to force subclassing. Subclasses shall choose a policy regarding whatever the arguments are cloned. This base class does not clone them because the same set of valid values (for example) is often shared for many metdata attributes.

Parameters:
obligation - Whatever the property is mandatory or forbidden, or null if unknown.
range - The range of valid values, or null if none.
validValues - An enumeration of valid values, or null if none.
Since:
3.05
Method Detail

equals

public boolean equals(Object other)
Compares the given object with this restriction for equality.

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

hashCode

public int hashCode()
Returns a hash code value for this restriction.

Overrides:
hashCode in class Object

toString

public String toString()
Returns a string representation of this restriction.

Overrides:
toString in class Object


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