Package net.sf.eBusx.time
Class EInterval.Builder
- java.lang.Object
-
- net.sf.eBus.messages.EMessageObject.Builder<M>
-
- net.sf.eBus.messages.EField.Builder<EInterval>
-
- net.sf.eBusx.time.EInterval.Builder
-
- Enclosing class:
- EInterval
public static final class EInterval.Builder extends EField.Builder<EInterval>
EInterval
instances may be created only by using aBuilder
instance. ABuilder
instance is obtained by callingEInterval.builder()
which returns a newly instantiatedBuilder
instance. It is recommended that a newBuilder
instance be used to create an interval rather than re-using a builder instance to create multiple intervals.
-
-
Field Summary
-
Fields inherited from class net.sf.eBus.messages.EMessageObject.Builder
mTargetClass
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EInterval.Builder
beginClusivity(EInterval.Clusivity clusivity)
Sets interval begin time clusivity.EInterval.Builder
beginTime(java.time.Instant beginTime)
Sets interval begin time.protected EInterval
buildImpl()
Returns a new interval instance based on this builder's settings.EInterval.Builder
endClusivity(EInterval.Clusivity clusivity)
Sets interval end time clusivity.EInterval.Builder
endTime(java.time.Instant endTime)
Sets the interval end time.protected Validator
validate(Validator problems)
Checks if: the begin and end times and clusivity are set and begin time is either < or ≤ end time depending on clusivity settings.-
Methods inherited from class net.sf.eBus.messages.EMessageObject.Builder
build
-
-
-
-
Method Detail
-
validate
protected Validator validate(Validator problems)
Checks if:- the begin and end times and clusivity are set and
- begin time is either < or ≤ end time depending on clusivity settings.
- if begin time equals end time then both times must be inclusive.
- Overrides:
validate
in classEField.Builder<EInterval>
- Parameters:
problems
- add each detected problem to this validator.- Returns:
problems
.- See Also:
Validator
-
buildImpl
protected EInterval buildImpl()
Returns a new interval instance based on this builder's settings.- Specified by:
buildImpl
in classEMessageObject.Builder<EInterval>
- Returns:
- new interval instance.
-
beginTime
public EInterval.Builder beginTime(java.time.Instant beginTime)
Sets interval begin time. Returnsthis Builder
instance so that builder method calls can be chained.- Parameters:
beginTime
- interval begin time.- Returns:
this Builder
instance.- Throws:
java.lang.NullPointerException
- ifbeginTime
isnull
.
-
beginClusivity
public EInterval.Builder beginClusivity(EInterval.Clusivity clusivity)
Sets interval begin time clusivity. Returnsthis Builder
instance so that builder method calls can be chained.- Parameters:
clusivity
- interval begin time clusivity.- Returns:
this Builder
instance.- Throws:
java.lang.NullPointerException
- ifclusivity
isnull
.
-
endTime
public EInterval.Builder endTime(java.time.Instant endTime)
Sets the interval end time. Returnsthis Builder
instance so that builder method calls can be chained.- Parameters:
endTime
- interval end time.- Returns:
this Builder
instance.- Throws:
java.lang.NullPointerException
- ifendTime
isnull
.
-
endClusivity
public EInterval.Builder endClusivity(EInterval.Clusivity clusivity)
Sets interval end time clusivity. Returnsthis Builder
instance so that builder method calls can be chained.- Parameters:
clusivity
- interval begin time clusivity.- Returns:
this Builder
instance.- Throws:
java.lang.NullPointerException
- ifclusivity
isnull
.
-
-