Interface SelectionBuilderBase<B extends SelectionBuilderBase<B,S>, S extends SelectionBase>
- Type Parameters:
B- the specific kind of this builderS- 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 Summary
Modifier and TypeMethodDescriptionbuild()Builds a selection from the details of this builder.default BescalationTrack(EscalationTrack escalationTrack) Sets the escalation track matched.escalationTracks(SelectionPredicate<Optional<EscalationTrack>> escalationTracks) Sets the escalation tracks matched.limitToRetrieve(int limitToRetrieve) Sets the amount of punishments to retrieve.default BSets the operator matched.operators(SelectionPredicate<Operator> operators) Sets the operators matched.default Bscope(ServerScope scope) Sets the scope matched.scopes(SelectionPredicate<ServerScope> scopes) Sets the scopes matched.Sets the time after which punishments will be retrieved.seekBefore(Instant maximumStartTime, long maximumId) Sets the time before which punishments will be retrieved.default BSets that only active punishments should be matched.selectActiveOnly(boolean selectActiveOnly) Sets whether only active punishments should be matched.default BSets that all punishments, not just those active, should be matched.skipFirstRetrieved(int skipCount) Sets the amount of punishments to skip when retrieving.default Btype(PunishmentType type) Sets the punishment type matched.types(SelectionPredicate<PunishmentType> types) Sets the punishment types matched.
-
Method Details
-
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
-
operators
Sets the operators matched. All are matched by default.- Parameters:
operators- the operator predicate- Returns:
- this builder
-
scope
Sets the scope matched. All are matched by default.- Parameters:
scope- the scope- Returns:
- this builder
-
scopes
Sets the scopes matched. All are matched by default.- Parameters:
scopes- the scope predicate- Returns:
- this builder
-
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
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
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
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
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
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 withlimitToRetrieve(int).
Behavior is unspecified if this is used simultaneously withseekAfter(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- ifskipCountis negative
-
limitToRetrieve
Sets the amount of punishments to retrieve. Unlimited by default.
If this is used withskipFirstRetrieved(int), the amount of punishments retrieved is still equal tolimitToRetrieve. In other words, this method is the same as SQL'sLIMITclause.- Parameters:
limitToRetrieve- the amount of punishments to retrieve,0for unlimited- Returns:
- this builder
- Throws:
IllegalArgumentException- iflimitToRetrieveis negative
-
seekAfter
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 tominimumStartTime, its ID will be checked againstminimumId. The punishment will then be selected if its ID is equal to or greater thanminimumId.
To reset this option to the default value, use a minimum start time ofInstant.EPOCH, in which case the minimum ID is ignored.
This method may be used to implement keyset pagination of selected punishments, together withlimitToRetrieve(int).
Behavior is unspecified if this is used simultaneously withskipFirstRetrieved(int). Callers should consider the methods exclusive to avoid unspecified behavior.- Parameters:
minimumStartTime- the minimum start time, orInstant.EPOCHto reset this optionminimumId- the minimum ID- Returns:
- this builder
-
seekBefore
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 tomaximumStartTime, its ID will be checked againstmaximumId. The punishment will then be selected if its ID is equal to or less thanmaximumId.
To reset this option to the default value, use a maximum start time ofInstant.MAX, in which case the maximum ID is ignored.
This method may be used to implement keyset pagination of selected punishments, together withlimitToRetrieve(int).
Behavior is unspecified if this is used simultaneously withskipFirstRetrieved(int). Callers should consider the methods exclusive to avoid unspecified behavior.- Parameters:
maximumStartTime- the maximum start time, orInstant.MAXto reset this optionmaximumId- 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
-