public class DefaultRecordSchema extends Object implements RecordSchema
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.DefaultRecordSchema 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.
RecordSchema contain an arbitrary amount 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.DefaultRecordType,
DefaultRecordDefined in the sis-utility module
| Modifier and Type | Field and Description |
|---|---|
protected DefaultNameFactory |
nameFactory
The factory to use for creating names.
|
| Constructor and Description |
|---|
DefaultRecordSchema(DefaultNameFactory nameFactory,
NameSpace parent,
CharSequence schemaName)
Creates a new schema of the given name.
|
| Modifier and Type | Method and Description |
|---|---|
RecordType |
createRecordType(CharSequence typeName,
Map<CharSequence,Class<?>> members)
Creates a new record type of the given name, which will contains the given members.
|
Map<TypeName,RecordType> |
getDescription()
Returns the dictionary of all (name, record type) pairs in this schema.
|
LocalName |
getSchemaName()
Returns the schema name.
|
RecordType |
locate(TypeName name)
Returns the record type for the given name.
|
String |
toString()
Returns a string representation of this schema for debugging purpose only.
|
protected final DefaultNameFactory nameFactory
NameFactory interface when that interface
will provide a createMemberName(…) method (tentatively in GeoAPI 3.1).
public DefaultRecordSchema(DefaultNameFactory nameFactory, NameSpace parent, CharSequence schemaName)
NameFactory interface when
that interface will provide a createMemberName(…) method (tentatively in GeoAPI 3.1).
nameFactory - the factory to use for creating names, or null for the default factory.parent - the parent namespace, or null if none.schemaName - the name of the new schema.public LocalName getSchemaName()
getSchemaName in interface RecordSchemapublic RecordType createRecordType(CharSequence typeName, Map<CharSequence,Class<?>> members) throws IllegalArgumentException
typeName - the record type name.members - the name of each record member, together with the expected value types.IllegalArgumentException - if a record already exists for the given name but with different members.public Map<TypeName,RecordType> getDescription()
getDescription in interface RecordSchemapublic RecordType locate(TypeName name)
null.locate in interface RecordSchemaname - the name of the type to lookup.null if none.Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.