Package org.apache.sis.util.iso
Class RecordDefinition
java.lang.Object
org.apache.sis.util.iso.RecordDefinition
- Direct Known Subclasses:
DefaultRecordType
,RecordDefinition.Adapter
Holds a
Record
definition in a way more convenient for Apache SIS than
what the RecordType
interface provides.
Serialization
This base class is intentionally not serializable, and all private fields are marked as transient for making this decision more visible. This is because the internal details of this class are quite arbitrary, so we do not want to expose them in serialization for compatibility reasons. Furthermore, some information are redundant, so a serialization performed by subclasses may be more compact. Serialization of all necessary data shall be performed by subclasses, and the transient fields shall be reconstructed by a call tocomputeTransientFields(Map)
.- Since:
- 0.5
- Version:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
RecordDefinition
implementation used as a fallback when the user suppliedRecordType
is not an instance ofDefaultRecordType
. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) final Class
<?> Returns the common parent of all value classes.(package private) final org.opengis.util.Type[]
computeTransientFields
(Map<? extends org.opengis.util.MemberName, ? extends org.opengis.util.Type> fieldTypes) Invoked on construction or deserialization for computing the transient fields.Read-only access to the map of field indices.(package private) final org.opengis.util.MemberName
getName
(int index) Returns the name of the field at the given index.(package private) abstract org.opengis.util.RecordType
Returns the record type for which this object is a definition.(package private) final Class
<?> getValueClass
(int index) Returns the expected class of values in the given column, ornull
if unspecified.(package private) final Integer
indexOf
(org.opengis.util.MemberName fieldName) Returns the index of the given name, ornull
if none.(package private) final int
size()
Returns the number of elements in records.toString()
Returns a string representation of this object.(package private) final String
Returns a string representation of aRecord
orRecordType
.
-
Field Details
-
fieldIndices
Indices of field names. Created on construction or deserialization, and shall be considered final and unmodifiable after that point.- See Also:
-
fieldNames
private transient org.opengis.util.MemberName[] fieldNamesField names. Created on construction or deserialization, and shall be considered final and unmodifiable after that point. -
valueClasses
Classes of expected values, ornull
if there is no restriction. Created on construction or deserialization, and shall be considered final and unmodifiable after that point. -
baseValueClass
The common parent of all value classes. May be a primitive type.
-
-
Constructor Details
-
RecordDefinition
RecordDefinition()Creates a new instance. Subclasses shall invokecomputeTransientFields(Map)
in their constructor.
-
-
Method Details
-
getRecordType
abstract org.opengis.util.RecordType getRecordType()Returns the record type for which this object is a definition. -
computeTransientFields
final org.opengis.util.Type[] computeTransientFields(Map<? extends org.opengis.util.MemberName, ? extends org.opengis.util.Type> fieldTypes) Invoked on construction or deserialization for computing the transient fields.- Parameters:
fieldTypes
- the (name, type) pairs in this record type.- Returns:
- the values in the given map. This information is not stored in
RecordDefinition
because not needed by this class, but theDefaultRecordType
subclass will store it.
-
baseValueClass
Returns the common parent of all value classes. May be a primitive type. -
fieldIndices
Read-only access to the map of field indices. -
size
final int size()Returns the number of elements in records. -
indexOf
Returns the index of the given name, ornull
if none. -
getName
final org.opengis.util.MemberName getName(int index) Returns the name of the field at the given index. -
getValueClass
Returns the expected class of values in the given column, ornull
if unspecified. -
toString
Returns a string representation of this object. The string representation is for debugging purpose and may change in any future SIS version. -
toString
Returns a string representation of aRecord
orRecordType
.- Parameters:
head
- either"Record"
or"RecordType"
ornull
.values
- the values as an array, ornull
for writing the types instead.- Returns:
- the string representation.
-