Class DefaultRecordSchema
Object
DefaultRecordSchema
- All Implemented Interfaces:
RecordSchema
@Deprecated(since="1.5",
forRemoval=true)
public class DefaultRecordSchema
extends Object
implements RecordSchema
Deprecated, for removal: This API element is subject to removal in a future version.
A collection of record types in a given namespace.
This class works also as a factory for creating
RecordType
and Record
instances.
The factory methods are:
Subclasses can modify the characteristics of the records to be created
by overriding the following methods:
DefaultNameFactory.toTypeName(Class)
if the factory given to the constructor.
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.
Limitations
This class is currently not serializable becauseRecordSchema
contain an arbitrary number of record
types in its description map. Since each RecordType
has a reference
to its schema, serializing a single RecordType
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 readResolve()
method (as documented in the
Serializable
interface) returning a system-wide static constant for their schema.- Since:
- 0.5
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DefaultNameFactory
Deprecated, for removal: This API element is subject to removal in a future version.The factory to use for creating names. -
Constructor Summary
ConstructorsConstructorDescriptionDefaultRecordSchema
(DefaultNameFactory nameFactory, NameSpace parent, CharSequence schemaName) Deprecated, for removal: This API element is subject to removal in a future version.Creates a new schema of the given name. -
Method Summary
Modifier and TypeMethodDescriptioncreateRecordType
(CharSequence typeName, Map<CharSequence, Class<?>> fields) Deprecated, for removal: This API element is subject to removal in a future version.Creates a new record type of the given name, which will contain the given fields.createRecordTypeName
(CharSequence typeName) Deprecated, for removal: This API element is subject to removal in a future version.Creates the name of a record.Deprecated, for removal: This API element is subject to removal in a future version.Returns the dictionary of all (name, record type) pairs in this schema.Deprecated, for removal: This API element is subject to removal in a future version.Returns the schema name.Deprecated, for removal: This API element is subject to removal in a future version.Returns the record type for the given name.Deprecated, for removal: This API element is subject to removal in a future version.Returns a string representation of this schema for debugging purpose only.
-
Field Details
-
nameFactory
Deprecated, for removal: This API element is subject to removal in a future version.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 theNameFactory
interface when that interface will provide acreateMemberName(…)
method (tentatively in GeoAPI 3.1).
-
-
Constructor Details
-
DefaultRecordSchema
public DefaultRecordSchema(DefaultNameFactory nameFactory, NameSpace parent, CharSequence schemaName) Deprecated, for removal: This API element is subject to removal in a future version.Creates a new schema of the given name.Upcoming API change — generalization
This type of the first argument will be changed to theNameFactory
interface when that interface will provide acreateMemberName(…)
method (tentatively in GeoAPI 3.1).- Parameters:
nameFactory
- the factory to use for creating names, ornull
for the default factory.parent
- the parent namespace, ornull
if none.schemaName
- the name of the new schema.
-
-
Method Details
-
getSchemaName
Deprecated, for removal: This API element is subject to removal in a future version.Returns the schema name.- Specified by:
getSchemaName
in interfaceRecordSchema
- Returns:
- the schema name.
-
createRecordTypeName
Deprecated, for removal: This API element is subject to removal in a future version.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 RecordType createRecordType(CharSequence typeName, Map<CharSequence, Class<?>> fields) throws IllegalArgumentException Deprecated, for removal: This API element is subject to removal in a future version.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
Deprecated, for removal: This API element is subject to removal in a future version.Returns the dictionary of all (name, record type) pairs in this schema.- Specified by:
getDescription
in interfaceRecordSchema
- Returns:
- all (name, record type) pairs in this schema.
-
locate
Deprecated, for removal: This API element is subject to removal in a future version.Returns the record type for the given name. If the type name is not defined within this schema, then this method returnsnull
.- Specified by:
locate
in interfaceRecordSchema
- Parameters:
name
- the name of the type to lookup.- Returns:
- the type for the given name, or
null
if none.
-
toString
-
RecordSchema
interface has been removed in the 2015 revision of the ISO 19103 standard.