Record Class ShapefileSchema

java.lang.Object
java.lang.Record
ch.so.agi.gretl.internal.shapefile.core.ShapefileSchema

public record ShapefileSchema(ShapeType shapeType, List<DbfField> fields) extends Record
Describes the structure of a Shapefile dataset to be written: the geometry ShapeType of the .shp file and the ordered list of .dbf fields.

The order of fields() defines the order in which attribute values must be supplied to ShapefileDatasetWriter.write(com.vividsolutions.jts.geom.Geometry, Object[]).

This is a low-level, format-only description. It intentionally lives in the core package and knows nothing about INTERLIS, IOX or the mapping layer.

  • Constructor Details

    • ShapefileSchema

      public ShapefileSchema(ShapeType shapeType, List<DbfField> fields)
      Creates an instance of a ShapefileSchema record class.
      Parameters:
      shapeType - the value for the shapeType record component
      fields - the value for the fields record component
  • Method Details

    • validateWritable

      public void validateWritable() throws ShapefileMappingException
      Validates that this schema describes a geometry type the writer can produce. The writer supports Point, MultiPoint, PolyLine and Polygon.
      Throws:
      ShapefileMappingException
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • shapeType

      public ShapeType shapeType()
      Returns the value of the shapeType record component.
      Returns:
      the value of the shapeType record component
    • fields

      public List<DbfField> fields()
      Returns the value of the fields record component.
      Returns:
      the value of the fields record component