Interface RecordType

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 about RecordType as equivalent to a simple feature (ISO 19109) or a Java Class, then we can establish the following equivalence table:
Equivalences between records, features and Java constructs
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 Details

    • getTypeName

      Returns the name that identifies this record type.
      Comparison with Java reflection: if we think about this RecordType as equivalent to a Class instance, then this method can be though as the equivalent of the Java Class.getName() method.
      Specified by:
      getTypeName in interface Type
      Returns:
      the name that identifies this record type.
    • getContainer

      Deprecated.
      The RecordSchema 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 this RecordType as equivalent to a Class instance, then this method can be though as the equivalent of the Java Class.getPackage() method.
      Returns:
      the schema that contains this record 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 unmodifiable
      Comparison with Java reflection: if we think about this RecordType as equivalent to a Class instance, then this method can be though as related to the Java Class.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.
      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

      default Set<MemberName> getMembers()
      Returns the names of fields defined in this RecordType's dictionary. This method is functionally equivalent to getFieldTypes().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.
      This method has been removed in ISO 19103:2015. The same functionality is available with getFieldTypes().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 returns null. This method is functionally equivalent to the following code, omitting the check for null values:
      return getFieldTypes().get(name).getTypeName()
      Comparison with Java reflection: if we think about this RecordType as equivalent to a Class instance, then this method can be though as related to the Java Class.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

      boolean isInstance(Record record)
      Determines if the specified record is compatible with this record type. This method returns true if the specified record argument is non-null and the following minimal condition holds:
      Set<MemberName> fieldNames = record.getFields().keySet();
      boolean isInstance = getMembers().containsAll(fieldNames);
      
      Vendors can put additional implementation-specific conditions. In particular, implementations are free to require equals(Record.getRecordType()).
      Comparison with Java reflection: if we think about this RecordType as equivalent to a Class instance, then this method can be though as the equivalent of the Java Class.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.