Class Comparison

java.lang.Object
com.draftable.api.client.Comparison

public final class Comparison extends Object
Represents a comparison that has been created.
  • Constructor Details

    • Comparison

      public Comparison(@Nonnull String identifier, @Nonnull Comparison.Side left, @Nonnull Comparison.Side right, boolean isPublic, @Nonnull Instant creationTime, @Nullable Instant expiryTime, boolean ready, @Nullable Instant readyTime, @Nullable Boolean failed, @Nullable String errorMessage)
      Creates a representation of a comparison that has been created.
      Parameters:
      identifier - The comparison's identifier.
      left - Representation of the left file.
      right - Representation of the right file.
      isPublic - Whether the comparison is public or private.
      creationTime - When the comparison was created.
      expiryTime - When the comparison expires, or null if it doesn't expire.
      ready - Whether the comparison has been processed.
      readyTime - If the comparison is ready, the time at which it became ready.
      failed - Whether the comparison failed. Is null if the comparison hasn't been processed.
      errorMessage - If the comparison failed, gives an error message describing the failure. Null otherwise.
  • Method Details

    • getIdentifier

      @Nonnull public final String getIdentifier()
      Gets the comparison's identifier.
      Returns:
      The comparison's identifier.
    • getLeft

      @Nonnull public final Comparison.Side getLeft()
      Gets metadata for the left file.
      Returns:
      Metadata for the left file.
    • getRight

      @Nonnull public final Comparison.Side getRight()
      Gets metadata for the right file.
      Returns:
      Metadata for the right file.
    • getIsPublic

      public final boolean getIsPublic()
      Gets whether the comparison is public or private.
      Returns:
      true if the comparison is public, false otherwise.
    • getCreationTime

      @Nonnull public final Instant getCreationTime()
      Gets when the comparison was created.
      Returns:
      When the comparison was created.
    • getExpiryTime

      @Nullable public final Instant getExpiryTime()
      Gets when the comparison expires, or null if it doesn't expire.
      Returns:
      When the comparison expires, or null if it doesn't expire.
    • getReady

      public final boolean getReady()
      Gets whether the comparison has been processed.
      Returns:
      true if the comparison has been processed, false otherwise.
    • getReadyTime

      @Nullable public final Instant getReadyTime()
      If the comparison is ready, gives the time at which processing finished.
      Returns:
      When the comparison became ready, or null if it's not ready yet.
    • getFailed

      @Nullable public final Boolean getFailed()
      Gets whether the comparison failed. Is null if the comparison hasn't been processed (i.e. isn't ready).
      Returns:
      true if the comparison failed, false if the comparison is ready and succeeded, and null if the comparison isn't ready.
    • getErrorMessage

      @Nullable public final String getErrorMessage()
      If the comparison failed, gets an message describing error. Otherwise, returns null.
      Returns:
      A message describing the error if the comparison has failed. Null if the comparison isn't ready or succeeded.
    • toString

      public final String toString()
      Overrides:
      toString in class Object