Interface SelectionBuilderBase<B extends SelectionBuilderBase<B,S>, S extends SelectionBase>

Type Parameters:
B - the specific kind of this builder
S - the specific kind of the corresponding selection
All Known Subinterfaces:
SelectionByApplicabilityBuilder, SelectionOrderBuilder

public interface SelectionBuilderBase<B extends SelectionBuilderBase<B,S>, S extends SelectionBase>
Base interface for the builder of a selection.
  • Method Details

    • type

      default B type(PunishmentType type)
      Sets the punishment type matched. All are matched by default.
      Parameters:
      type - the punishment type
      Returns:
      this builder
    • types

      Sets the punishment types matched. All are matched by default.
      Parameters:
      types - the punishment type predicate
      Returns:
      this builder
    • operator

      default B operator(Operator operator)
      Sets the operator matched. All are matched by default.
      Parameters:
      operator - the operator
      Returns:
      this builder
    • operators

      B operators(SelectionPredicate<Operator> operators)
      Sets the operators matched. All are matched by default.
      Parameters:
      operators - the operator predicate
      Returns:
      this builder
    • scope

      default B scope(ServerScope scope)
      Sets the scope matched. All are matched by default.
      Parameters:
      scope - the scope
      Returns:
      this builder
    • scopes

      B scopes(SelectionPredicate<ServerScope> scopes)
      Sets the scopes matched. All are matched by default.
      Parameters:
      scopes - the scope predicate
      Returns:
      this builder
    • escalationTrack

      default B escalationTrack(EscalationTrack escalationTrack)
      Sets the escalation track matched. All are matched by default.
      Parameters:
      escalationTrack - the escalation track, or null to match the inexistence of a track
      Returns:
      this builder
    • escalationTracks

      B escalationTracks(SelectionPredicate<Optional<EscalationTrack>> escalationTracks)
      Sets the escalation tracks matched. All are matched by default. An empty optional indicates the inexistence of a track
      Parameters:
      escalationTracks - the escalation track predicate
      Returns:
      this builder
    • selectActiveOnly

      B selectActiveOnly(boolean selectActiveOnly)
      Sets whether only active punishments should be matched. True by default, meaning only active punishments are selected.

      Active punishments are those not expired and not undone.
      Parameters:
      selectActiveOnly - whether to select active punishments only
      Returns:
      this builder
    • selectActiveOnly

      default B selectActiveOnly()
      Sets that only active punishments should be matched. Enabled by default, meaning only active punishments are selected.

      Active punishments are those not expired and not undone.
      Returns:
      this builder
    • selectAll

      default B selectAll()
      Sets that all punishments, not just those active, should be matched. When this method is used, historical punishments and expired punishments are selected.

      Active punishments are those not expired and not undone.
      Returns:
      this builder
    • skipFirstRetrieved

      B skipFirstRetrieved(int skipCount)
      Sets the amount of punishments to skip when retrieving. No punishments are skipped by default.

      This method may be used to implement offset pagination of selected punishments, together with limitToRetrieve(int).

      Behavior is unspecified if this is used simultaneously with seekAfter(Instant, long). Callers should consider the methods exclusive to avoid unspecified behavior.
      Parameters:
      skipCount - the amount of punishments to skip
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if skipCount is negative
    • limitToRetrieve

      B limitToRetrieve(int limitToRetrieve)
      Sets the amount of punishments to retrieve. Unlimited by default.

      If this is used with skipFirstRetrieved(int), the amount of punishments retrieved is still equal to limitToRetrieve. In other words, this method is the same as SQL's LIMIT clause.
      Parameters:
      limitToRetrieve - the amount of punishments to retrieve, 0 for unlimited
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if limitToRetrieve is negative
    • seekAfter

      B seekAfter(Instant minimumStartTime, long minimumId)
      Sets the time after which punishments will be retrieved. Only punishments whose start time (Punishment.getStartDate()) is after or equal to the given value will be selected.

      If a punishment has a start time equal to minimumStartTime, its ID will be checked against minimumId. The punishment will then be selected if its ID is equal to or greater than minimumId.

      To reset this option to the default value, use a minimum start time of Instant.EPOCH, in which case the minimum ID is ignored.
      This method may be used to implement keyset pagination of selected punishments, together with limitToRetrieve(int).

      Behavior is unspecified if this is used simultaneously with skipFirstRetrieved(int). Callers should consider the methods exclusive to avoid unspecified behavior.
      Parameters:
      minimumStartTime - the minimum start time, or Instant.EPOCH to reset this option
      minimumId - the minimum ID
      Returns:
      this builder
    • seekBefore

      B seekBefore(Instant maximumStartTime, long maximumId)
      Sets the time before which punishments will be retrieved. Only punishments whose start time (Punishment.getStartDate()) is before or equal to the given value will be selected.

      If a punishment has a start time equal to maximumStartTime, its ID will be checked against maximumId. The punishment will then be selected if its ID is equal to or less than maximumId.

      To reset this option to the default value, use a maximum start time of Instant.MAX, in which case the maximum ID is ignored.
      This method may be used to implement keyset pagination of selected punishments, together with limitToRetrieve(int).

      Behavior is unspecified if this is used simultaneously with skipFirstRetrieved(int). Callers should consider the methods exclusive to avoid unspecified behavior.
      Parameters:
      maximumStartTime - the maximum start time, or Instant.MAX to reset this option
      maximumId - the maximum ID
      Returns:
      this builder
    • build

      S build()
      Builds a selection from the details of this builder. May be used repeatedly without side effects.
      Returns:
      a selection from this builder's details
      Throws:
      IllegalStateException - if the required details on this builder have not been set