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 classRecordDefinitionimplementation used as a fallback when the user suppliedRecordTypeis 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.MemberNamegetName(int index) Returns the name of the field at the given index.(package private) abstract org.opengis.util.RecordTypeReturns 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, ornullif unspecified.(package private) final IntegerindexOf(org.opengis.util.MemberName fieldName) Returns the index of the given name, ornullif none.(package private) final intsize()Returns the number of elements in records.toString()Returns a string representation of this object.(package private) final StringReturns a string representation of aRecordorRecordType.
-
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, ornullif 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
RecordDefinitionbecause not needed by this class, but theDefaultRecordTypesubclass 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, ornullif 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, ornullif 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 aRecordorRecordType.- Parameters:
head- either"Record"or"RecordType"ornull.values- the values as an array, ornullfor writing the types instead.- Returns:
- the string representation.
-