Class SnapshotIndex
- java.lang.Object
-
- io.datareplication.model.snapshot.SnapshotIndex
-
public final class SnapshotIndex extends java.lang.Object
The index of a snapshot. In addition to some metadata, this primarily contains of a list of URLs to the pages that make up this snapshot.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SnapshotIndex.ParsingException
ParsingException occurs when a SnapshotIndex can't be parsed
-
Constructor Summary
Constructors Constructor Description SnapshotIndex(@NonNull SnapshotId id, @NonNull java.time.Instant createdAt, @NonNull java.util.List<@NonNull Url> pages)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NonNull java.time.Instant
createdAt()
The timestamp of the dataset contained in this snapshot.boolean
equals(java.lang.Object o)
static @NonNull SnapshotIndex
fromJson(@NonNull Body json)
Parses Tries to parse JSON a SnapshotIndexint
hashCode()
@NonNull SnapshotId
id()
The ID of the snapshot.@NonNull java.util.List<@NonNull Url>
pages()
The URLs of the pages that make up this snapshot.@NonNull Body
toJson()
Converts this Snapshot instance to a Bodyjava.lang.String
toString()
-
-
-
Constructor Detail
-
SnapshotIndex
public SnapshotIndex(@NonNull @NonNull SnapshotId id, @NonNull @NonNull java.time.Instant createdAt, @NonNull @NonNull java.util.List<@NonNull Url> pages)
-
-
Method Detail
-
toJson
@NonNull public @NonNull Body toJson()
Converts this Snapshot instance to a Body- Returns:
- the converted Body
-
fromJson
@NonNull public static @NonNull SnapshotIndex fromJson(@NonNull @NonNull Body json) throws java.io.IOException
Parses Tries to parse JSON a SnapshotIndex- Parameters:
json
- the json representation of a SnapshotIndex- Returns:
- the parsed SnapshotIndex
- Throws:
SnapshotIndex.ParsingException
- if JSON is not a SnapshotIndexjava.io.IOException
- if the underlying Body throws an IOException
-
id
@NonNull public @NonNull SnapshotId id()
The ID of the snapshot.
-
createdAt
@NonNull public @NonNull java.time.Instant createdAt()
The timestamp of the dataset contained in this snapshot. This is usually the time when snapshot creation started.
-
pages
@NonNull public @NonNull java.util.List<@NonNull Url> pages()
The URLs of the pages that make up this snapshot.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-