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 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 in ISO 19103:2015.default void
set
(MemberName name, Object value) Deprecated.UsegetFields().put(name, value)
instead.
-
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);
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. 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 @UML(identifier="memberValue", obligation=MANDATORY, specification=ISO_19103, version=2005) default Map<MemberName,Object> getAttributes()Deprecated.RenamedgetFields()
.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 @UML(identifier="locate", obligation=MANDATORY, specification=ISO_19103, version=2005) default Object locate(MemberName name) Deprecated.This method has been removed in ISO 19103:2015. The same functionality is available withgetFields().get(name)
.Returns the value for a field of the specified name. This is functionally equivalent togetFields().get(name)
. The type of the returned object is given bygetRecordType().locate(name)
.- Parameters:
name
- the name of the field to lookup.- Returns:
- the value of the field for the given name.
- See Also:
-
set
Deprecated.UsegetFields().put(name, value)
instead.Sets the value for the field of the specified name. This is functionally equivalent togetFields().put(name, value)
. Remind thatname
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.- Departure from OGC/ISO abstract specification:
Extension for convenience without introduction of new functionality
This method provides no additional functionality compared to the ISO standard methods, but is declared in GeoAPI as a convenient shortcut.
-
getFields()
.