Package org.opengis.util
Interface Record
-
@UML(identifier="Record", specification=ISO_19103) public interface Record
A list of logically related elements as (name, value) pairs in a dictionary.Records
are similar to an attribute-onlyclass
in Java if it were stripped of all notions of inheritance. ARecord
may be used as an implementation representation for features.Comparison with Java reflection
If we think aboutRecord
s as equivalent toObject
instances, then the descriptions of those records (RecordType
) can be though as equivalent to JavaClass
instances, and the set of members in aRecord
can be though as the equivalent ofClass.getFields()
.- Since:
- 2.1
- See Also:
RecordType
-
-
Method Summary
Modifier and Type Method Description Map<MemberName,Object>
getAttributes()
Returns the dictionary of all (name, value) pairs in this record.RecordType
getRecordType()
Returns the type definition of record.Object
locate(MemberName name)
Returns the value for an attribute of the specified name.void
set(MemberName name, Object value)
Sets the value for the attribute of the specified name.
-
-
-
Method Detail
-
getRecordType
@UML(identifier="recordType", obligation=OPTIONAL, specification=ISO_19103) RecordType getRecordType()
Returns the type definition of record. All attributes named in this record must be defined in the returned record type. In other words, the following assertion must holds:Set<MemberName> members = getRecordType().getMembers(); Set<MemberName> attributes = getAttributes().keySet(); assert members.containsAll(attributes);
Comparison with Java reflection
If we think about thisRecord
as equivalent to anObject
instance, then this method can be though as the equivalent of the JavaObject.getClass()
method.- Returns:
- the type definition of this record, or
null
.
-
getAttributes
@UML(identifier="memberValue", obligation=MANDATORY, specification=ISO_19103) Map<MemberName,Object> getAttributes()
Returns the dictionary of all (name, value) pairs in this record. The returned map shall not allows key addition. It may allows the replacement of values for existing keys only.- Returns:
- the dictionary of all (name, value) pairs in this record.
- See Also:
RecordType.getMemberTypes()
Departure from OGC/ISO specification:
Figure 15 in ISO 19103:2005 specifies a multiplicity of 1. However, this seems to contradict the semantics of thelocate(name)
andRecordType.getMemberTypes()
methods.
-
locate
@UML(identifier="locate", obligation=MANDATORY, specification=ISO_19103) Object locate(MemberName name)
Returns the value for an attribute of the specified name. This is functionally equivalent togetAttributes().get(name)
. The type of the returned object is given bygetRecordType().getMemberTypes().get(name)
.- Parameters:
name
- the name of the attribute to lookup.- Returns:
- the value of the attribute for the given name.
- See Also:
RecordType.locate(MemberName)
-
set
void set(MemberName name, Object value) throws UnsupportedOperationException
Sets the value for the attribute of the specified name. This is functionally equivalent togetAttributes().put(name,value)
. Remind thatname
keys are constrained to record type members only.- Parameters:
name
- the name of the attribute to modify.value
- the new value for the attribute.- Throws:
UnsupportedOperationException
- if this record is not modifiable.
Departure from OGC/ISO specification:
This method provides no additional functionality compared to the ISO standard methods, but is declared in GeoAPI as a convenient shortcut.
-
-