|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectValueRestriction
@Immutable public class ValueRestriction
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(...).
MetadataStandard#asRestrictionMap(Object, NullValuePolicy, KeyNamePolicy),
Serialized Form
| 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 |
|---|
public final Obligation obligation
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.
public final NumberRange<?> range
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.
public final Set<?> validValues
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.
| Constructor Detail |
|---|
protected ValueRestriction(Obligation obligation,
NumberRange<?> range,
Set<?> validValues)
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.
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.| Method Detail |
|---|
public boolean equals(Object other)
equals in class Objectother - The object to compare with this restriction for equality.
true if both objects are equal.public int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||