Record Class DatasetManifest
java.lang.Object
java.lang.Record
com.marksayson.deletionchecker.manifest.DatasetManifest
- Record Components:
formatVersion- the manifest JSON schema version (alwaysSUPPORTED_FORMAT_VERSIONfor an instance returned byread(java.nio.file.Path))datasetVersion- the ISO-8601 timestamp identifying the generation rungeneratorVersion- the semantic version of the generator that produced the releaseentityTypes- 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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe manifest file's name within a dataset directory.static final intThe manifest JSON schema version this build reads and writes. -
Constructor Summary
ConstructorsConstructorDescriptionDatasetManifest(int formatVersion, String datasetVersion, String generatorVersion, List<EntityTypeEntry> entityTypes) Makes the entity-type list immutable. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedatasetVersionrecord component.Returns the value of theentityTypesrecord component.Returns the entry forentityType, if the release contains it.final booleanIndicates whether some other object is "equal to" this one.intReturns the value of theformatVersionrecord component.Returns the value of thegeneratorVersionrecord component.final inthashCode()Returns a hash code value for this object.static DatasetManifestReads and verifies the manifest atpath.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
SUPPORTED_FORMAT_VERSION
public static final int SUPPORTED_FORMAT_VERSIONThe manifest JSON schema version this build reads and writes.- See Also:
-
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
Reads and verifies the manifest atpath.- Parameters:
path- the manifest file- Returns:
- the parsed, verified manifest
- Throws:
IOException- if the file cannot be readInvalidManifestException- if the manifest is malformed or itsmanifestChecksumdoes not matchUnsupportedManifestVersionException- if the manifest'sformatVersionis notSUPPORTED_FORMAT_VERSION
-
entry
Returns the entry forentityType, 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
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
formatVersion
public int formatVersion()Returns the value of theformatVersionrecord component.- Returns:
- the value of the
formatVersionrecord component
-
datasetVersion
Returns the value of thedatasetVersionrecord component.- Returns:
- the value of the
datasetVersionrecord component
-
generatorVersion
Returns the value of thegeneratorVersionrecord component.- Returns:
- the value of the
generatorVersionrecord component
-
entityTypes
Returns the value of theentityTypesrecord component.- Returns:
- the value of the
entityTypesrecord component
-