- All Superinterfaces:
Type
@Classifier(METACLASS)
@UML(identifier="RecordType",
specification=ISO_19103)
public interface RecordType
extends Type
The type definition of a record.
A
RecordType
defines dynamically constructed data type.
It is identified by a type name
and contains an arbitrary number of fields.
Fields are (name, type) pairs where the type is often the wrapper
for a primitive type or a String
, but can also be another RecordType
.
Field values can be read and written but cannot be added or removed.
This approach ensures that once a RecordType
is constructed, it is immutable.
Comparison with features and Java reflection
If we think aboutRecordType
as equivalent to a simple feature (ISO 19109) or a Java Class
,
then we can establish the following equivalence table:
ISO 19103 | ISO 19109 | Java equivalent |
---|---|---|
Record |
Feature |
Object |
Record.getRecordType() |
Feature.getType() |
Object.getClass() |
RecordType |
FeatureType |
Class |
getTypeName() |
FeatureType.getName() |
Class.getName() |
getContainer() |
Class.getPackage() |
|
getFieldTypes() |
FeatureType.getProperties(boolean) |
Class.getFields() |
RecordType.locate(MemberName) |
getProperty(String) |
Class.getField(String) |
RecordType.isInstance(Record) |
Class.isInstance(Object) |
|
RecordSchema |
Package |
- Since:
- 2.1
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Returns the dictionary of all (name, type) pairs in this record type.default Set<MemberName>
Returns the names of fields defined in thisRecordType
's dictionary.default Map<MemberName,
Type> Deprecated.RenamedgetFieldTypes()
.Returns the name that identifies this record type.boolean
isInstance
(Record record) Determines if the specified record is compatible with this record type.default TypeName
locate
(MemberName name) Deprecated.This method has been removed in ISO 19103:2015.Methods inherited from interface Type
toJavaType
-
Method Details
-
getTypeName
@UML(identifier="typeName", obligation=MANDATORY, specification=ISO_19103, version=2005) TypeName getTypeName()Returns the name that identifies this record type.Comparison with Java reflection: if we think about thisRecordType
as equivalent to aClass
instance, then this method can be though as the equivalent of the JavaClass.getName()
method.- Specified by:
getTypeName
in interfaceType
- Returns:
- the name that identifies this record type.
-
getContainer
@Deprecated @UML(identifier="schema", obligation=MANDATORY, specification=ISO_19103, version=2005) RecordSchema getContainer()Deprecated.TheRecordSchema
interface has been removed in the 2015 revision of ISO 19103 standard.Returns the schema that contains this record type.Comparison with Java reflection: if we think about thisRecordType
as equivalent to aClass
instance, then this method can be though as the equivalent of the JavaClass.getPackage()
method.- Returns:
- the schema that contains this record type.
-
getFieldTypes
@UML(identifier="fieldType", obligation=MANDATORY, specification=ISO_19103) Map<MemberName,Type> getFieldTypes()Returns the dictionary of all (name, type) pairs in this record type. The dictionary shall contain at least one entry and should be unmodifiableComparison with Java reflection: if we think about thisRecordType
as equivalent to aClass
instance, then this method can be though as related to the JavaClass.getFields()
method.- Returns:
- the dictionary of all (name, type) pairs in this record type. Shall contain at least one entry.
- Since:
- 3.1
- See Also:
-
getMemberTypes
@Deprecated @UML(identifier="memberType", obligation=MANDATORY, specification=ISO_19103, version=2005) default Map<MemberName,Type> getMemberTypes()Deprecated.RenamedgetFieldTypes()
.Returns the dictionary of all (name, type) pairs in this record type. The dictionary should be unmodifiable. If there are no fields, this method returns the empty map.- Returns:
- the dictionary of all (name, type) pairs in this record type.
- See Also:
-
getMembers
Returns the names of fields defined in thisRecordType
's dictionary. This method is functionally equivalent togetFieldTypes().keySet()
.- Returns:
- the set of field names defined in this
RecordType
's dictionary. - Departure from OGC/ISO abstract specification:
Extension for convenience without introduction of new functionality
This method provides no additional information compared to the ISO standard methods, but is declared in GeoAPI as a convenient shortcut.
-
locate
@Deprecated @UML(identifier="locate", obligation=MANDATORY, specification=ISO_19103, version=2005) default TypeName locate(MemberName name) Deprecated.This method has been removed in ISO 19103:2015. The same functionality is available withgetFieldTypes().get(name).getTypeName()
.Looks up the provided field name and returns the associated type name. If the field name is not defined in this record type, then this method returnsnull
. This method is functionally equivalent to the following code, omitting the check fornull
values:return getFieldTypes().get(name).getTypeName()
Comparison with Java reflection: if we think about thisRecordType
as equivalent to aClass
instance, then this method can be though as related to the JavaClass.getField(String)
method.- Parameters:
name
- the name of the field to lookup.- Returns:
- the type of the field of the given name, or
null
. - See Also:
-
isInstance
Determines if the specified record is compatible with this record type. This method returnstrue
if the specifiedrecord
argument is non-null and the following minimal condition holds:Set<MemberName> fieldNames = record.getFields().keySet(); boolean isInstance = getMembers().containsAll(fieldNames);
equals(Record.getRecordType())
.Comparison with Java reflection: if we think about thisRecordType
as equivalent to aClass
instance, then this method can be though as the equivalent of the JavaClass.isInstance(Object)
method.- Parameters:
record
- the record to test for compatibility.- Returns:
true
if the given record is compatible with this record type.- Departure from OGC/ISO abstract specification:
Extension for convenience without introduction of new functionality
This method provides no additional information compared to the ISO standard methods, but is declared in GeoAPI for convenience.
-
RecordSchema
interface has been removed in the 2015 revision of ISO 19103 standard.