Class DefaultRecordSchema

All Implemented Interfaces:

public class DefaultRecordSchema extends Object implements RecordSchema
A collection of record types in a given namespace. This class works also as a factory for creating Record­Type and Record instances. The factory methods are: Subclasses can modify the characteristics of the records to be created by overriding the following methods:

Thread safety

The same Default­Record­Schema instance can be safely used by many threads without synchronization on the part of the caller if the Name­Factory given to the constructor is also thread-safe. Subclasses should make sure that any overridden methods remain safe to call from multiple threads.


This class is currently not serializable because Record­Schema contain an arbitrary amount of record types in its description map. Since each Record­Type has a reference to its schema, serializing a single Record­Type could imply serializing all of them. In order to reduce the risk of unexpected behavior, serialization is currently left to subclasses. For example a subclass may define a Object read­Resolve() method (as documented in the Serializable interface) returning a system-wide static constant for their schema.
See Also:

Defined in the sis-metadata module

  • Field Details

    • nameFactory

      protected final DefaultNameFactory nameFactory
      The factory to use for creating names. This is the factory given at construction time.
      Upcoming API change — generalization
      This field type will be changed to the Name­Factory interface when that interface will provide a create­Member­Name(…) method (tentatively in GeoAPI 3.1).
  • Constructor Details

    • DefaultRecordSchema

      public DefaultRecordSchema(DefaultNameFactory nameFactory, NameSpace parent, CharSequence schemaName)
      Creates a new schema of the given name.
      Upcoming API change — generalization
      This type of the first argument will be changed to the Name­Factory interface when that interface will provide a create­Member­Name(…) method (tentatively in GeoAPI 3.1).
      name­Factory - the factory to use for creating names, or null for the default factory.
      parent - the parent namespace, or null if none.
      schema­Name - the name of the new schema.
  • Method Details

    • getSchemaName

      public LocalName getSchemaName()
      Returns the schema name.
      Specified by:
      get­Schema­Name in interface Record­Schema
      the schema name.
    • createRecordType

      public RecordType createRecordType(CharSequence typeName, Map<CharSequence,Class<?>> fields) throws IllegalArgumentException
      Creates a new record type of the given name, which will contain the given fields. Fields are declared in iteration order.
      type­Name - the record type name.
      fields - the name of each record field, together with the expected value types.
      a record type of the given name and fields.
      Illegal­Argument­Exception - if a record already exists for the given name but with different fields.
    • getDescription

      public Map<TypeName,RecordType> getDescription()
      Returns the dictionary of all (name, record type) pairs in this schema.
      Specified by:
      get­Description in interface Record­Schema
      all (name, record type) pairs in this schema.
    • locate

      public RecordType locate(TypeName name)
      Returns the record type for the given name. If the type name is not defined within this schema, then this method returns null.
      Specified by:
      locate in interface Record­Schema
      name - the name of the type to lookup.
      the type for the given name, or null if none.
    • toString

      public String toString()
      Returns a string representation of this schema for debugging purpose only.
      to­String in class Object