Class DefaultRecordSchema
Object
DefaultRecordSchema
- All Implemented Interfaces:
Serializable, RecordSchema
A factory for creating
RecordType instances.
Possible future change:
This class is derived from ISO 19103:2005. The record attributes and methods have been modified
in ISO 19103:2015, then all classes related to records have been fully removed in ISO 19103:2024.
The implication for Apache SIS has not yet been determined.
In the meantime, this class should be considered as merely a factory of
DefaultRecordType instances.Thread safety
The sameDefaultRecordSchema instance can be safely used by many threads without synchronization
on the part of the caller if the NameFactory given to the constructor is also thread-safe.
Subclasses should make sure that any overridden methods remain safe to call from multiple threads.- Since:
- 0.5
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultRecordSchema(CharSequence schemaName) Creates a new schema of the given name. -
Method Summary
Modifier and TypeMethodDescriptioncreateRecordType(CharSequence typeName, Map<CharSequence, Class<?>> fields) Creates a new record type of the given name, which will contain the given fields.createRecordTypeName(CharSequence typeName) Creates the name of a record.Returns the dictionary of all (name, record type) pairs in this schema.Returns the schema name.Returns the record type for the given name.
-
Constructor Details
-
DefaultRecordSchema
Creates a new schema of the given name.- Parameters:
schemaName- the name of the new schema.- Since:
- 1.6
-
-
Method Details
-
getSchemaName
Returns the schema name.- Specified by:
getSchemaNamein interfaceRecordSchema- Returns:
- the schema name.
-
createRecordTypeName
Creates the name of a record.- Parameters:
typeName- name of the record type to create.- Returns:
- name of a record type.
- Since:
- 1.3
-
createRecordType
public DefaultRecordType 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.- Parameters:
typeName- name of the record type to create.fields- the name of each record field, together with the expected value types.- Returns:
- a record type of the given name and fields.
- Throws:
IllegalArgumentException- if a record already exists for the given name but with different fields.
-
getDescription
Returns the dictionary of all (name, record type) pairs in this schema.- Specified by:
getDescriptionin interfaceRecordSchema- Returns:
- all (name, record type) pairs in this schema.
-
locate
Returns the record type for the given name. If the type name is not defined within this schema, then this method returnsnull.- Specified by:
locatein interfaceRecordSchema- Parameters:
name- the name of the type to lookup.- Returns:
- the type for the given name, or
nullif none.
-