A list of logically related fields as (name, value) pairs in a dictionary.
A Relationship with Java
This interface serves a purpose similar to the
Record
is an instance of an RecordType
.
For example, a Record
may be a row in a table described by a RecordType
.
Relationship with Java Record
class
This interface serves a purpose similar to the Record
abstract class
provided by the standard Java platform, but is used in a different context.
The standard Java Record
class provides static records (i.e., with structure defined at compile time),
while this GeoAPI Record
interfaces provides dynamic records.
The former is more convenient, efficient and type-safe,
while the latter is the only option when the record structure is not known in advance,
for example when it is determined by the content of a data file being read.
If interoperability between the two models is desired,
a GeoAPI Record
implementation could delegate all operations
to a wrapped Java Record
using RecordComponent
.- Since:
- 2.1
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault Object
get
(MemberName name) Returns the value for a field of the specified name.default Map
<MemberName, Object> Deprecated.Returns the dictionary of all (name, value) pairs in this record.Returns the type definition of this record.default Object
locate
(MemberName name) Deprecated.This method has been removed from the ISO 19103:2015 standard.default void
set
(MemberName name, Object value) Sets the value for the field of the specified name.
-
Method Details
-
getRecordType
Returns the type definition of this record. All fields 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> fields = getFields().keySet(); assert members.containsAll(fields);
- Returns:
- the type definition of this record. May be
null
.
-
getFields
@UML(identifier="field", obligation=MANDATORY, specification=ISO_19103) Map<MemberName,Object> getFields()Returns the dictionary of all (name, value) pairs in this record. The returned map should not allows entry addition or removal. It may allows the replacement of values for existing keys only.- Returns:
- the dictionary of all (name, value) pairs in this record.
- Since:
- 3.1
- See Also:
-
getAttributes
@Deprecated(since="3.1") @UML(identifier="memberValue", obligation=MANDATORY, specification=ISO_19103, version=2005) default Map<MemberName,Object> getAttributes()Deprecated.RenamedgetFields()
in the 2015 revision of ISO 19103.Returns the dictionary of all (name, value) pairs in this record. The returned map should not allows key addition or removal. It may allows the replacement of values for existing keys only.- Returns:
- the dictionary of all (name, value) pairs in this record.
- See Also:
-
locate
Deprecated.This method has been removed from the ISO 19103:2015 standard. It has been kept in GeoAPI for convenience, but renamedget(MemberName)
for consistency with common practice.Returns the value for a field of the specified name.- Parameters:
name
- the name of the field to lookup.- Returns:
- the value of the field for the given name.
-
get
@UML(identifier="locate", obligation=MANDATORY, specification=ISO_19103, version=2005) default Object get(MemberName name) Returns the value for a field of the specified name. This is functionally equivalent to the following code:return getFields().get(name);
getRecordType().locate(name)
.- Parameters:
name
- the name of the field to lookup.- Returns:
- the value of the field for the given name.
- Since:
- 3.1
- See Also:
Departure from OGC/ISO standard for historical reason
This method was namedlocate
in ISO 19103:2005 and removed in ISO 19103:2015. It has been kept in GeoAPI as a convenience shortcut for a frequently used operation. -
set
Sets the value for the field of the specified name. This is functionally equivalent to the following code:getFields().put(name, value);
name
keys are constrained to record type members only.- Parameters:
name
- the name of the field to modify.value
- the new value for the field.- Throws:
UnsupportedOperationException
- if this record is not modifiable.
Convenience extension to OGC/ISO standard
This is a convenience shortcut for a frequently used operation.
-
getFields()
in the 2015 revision of ISO 19103.