Record Class DatasetManifest

java.lang.Object
java.lang.Record
com.marksayson.deletionchecker.manifest.DatasetManifest
Record Components:
formatVersion - the manifest JSON schema version (always SUPPORTED_FORMAT_VERSION for an instance returned by read(java.nio.file.Path))
datasetVersion - the ISO-8601 timestamp identifying the generation run
generatorVersion - the semantic version of the generator that produced the release
entityTypes - one entry per entity type in the release, in manifest order

public record DatasetManifest(int formatVersion, String datasetVersion, String generatorVersion, List<EntityTypeEntry> entityTypes) extends Record
A parsed, verified dataset manifest: the release's three version fields plus one entry per available entity type.
  • Field Details

    • SUPPORTED_FORMAT_VERSION

      public static final int SUPPORTED_FORMAT_VERSION
      The manifest JSON schema version this build reads and writes.
      See Also:
    • FILE_NAME

      public static final String FILE_NAME
      The manifest file's name within a dataset directory.
      See Also:
  • Constructor Details

    • DatasetManifest

      public DatasetManifest(int formatVersion, String datasetVersion, String generatorVersion, List<EntityTypeEntry> entityTypes)
      Makes the entity-type list immutable.
  • Method Details

    • read

      public static DatasetManifest read(Path path) throws IOException
      Reads and verifies the manifest at path.
      Parameters:
      path - the manifest file
      Returns:
      the parsed, verified manifest
      Throws:
      IOException - if the file cannot be read
      InvalidManifestException - if the manifest is malformed or its manifestChecksum does not match
      UnsupportedManifestVersionException - if the manifest's formatVersion is not SUPPORTED_FORMAT_VERSION
    • entry

      public Optional<EntityTypeEntry> entry(String entityType)
      Returns the entry for entityType, if the release contains it.
      Parameters:
      entityType - the entity type to look up
      Returns:
      the entry, or empty if the release has no such entity type
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • formatVersion

      public int formatVersion()
      Returns the value of the formatVersion record component.
      Returns:
      the value of the formatVersion record component
    • datasetVersion

      public String datasetVersion()
      Returns the value of the datasetVersion record component.
      Returns:
      the value of the datasetVersion record component
    • generatorVersion

      public String generatorVersion()
      Returns the value of the generatorVersion record component.
      Returns:
      the value of the generatorVersion record component
    • entityTypes

      public List<EntityTypeEntry> entityTypes()
      Returns the value of the entityTypes record component.
      Returns:
      the value of the entityTypes record component