@NotThreadSafe
public static final class TimeInterval.Builder
extends Object
implements Externalizable
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
TimeInterval |
build()
Builds a time interval.
|
TimeInterval.Builder |
clear()
Clears this builder.
|
TimeInterval.Builder |
copyFrom(TimeInterval otherInterval)
Copies the values from an other time interval.
|
static TimeInterval |
fromString(String intervalString)
Returns a time interval from a string representation.
|
Optional<DateTime> |
getAfter()
Gets the after time.
|
Optional<DateTime> |
getBefore()
Gets the before time.
|
boolean |
isInstant()
Asks if this time interval is an instant.
|
boolean |
isValid()
Asks if this time interval is valid.
|
void |
readExternal(ObjectInput input) |
TimeInterval.Builder |
setAfter(DateTime after)
Sets the after time.
|
TimeInterval.Builder |
setAt(DateTime at)
Sets an instant.
|
TimeInterval.Builder |
setBefore(DateTime before)
Sets the before time.
|
TimeInterval.Builder |
setNotAfter(DateTime notAfter)
Sets the not after time.
|
TimeInterval.Builder |
setNotBefore(DateTime notBefore)
Sets the not before time.
|
String |
toString() |
TimeInterval.Builder |
trim(TimeInterval limits)
Trims an interval to supplied limits.
|
void |
writeExternal(ObjectOutput output) |
@Nonnull @CheckReturnValue public static TimeInterval fromString(@Nonnull String intervalString)
intervalString
- The interval string.@Nonnull @CheckReturnValue public TimeInterval build()
@Nonnull public TimeInterval.Builder clear()
@Nonnull public TimeInterval.Builder copyFrom(@Nonnull TimeInterval otherInterval)
otherInterval
- The other time interval.@Nonnull @CheckReturnValue public Optional<DateTime> getAfter()
@Nonnull @CheckReturnValue public Optional<DateTime> getBefore()
@CheckReturnValue public boolean isInstant()
@CheckReturnValue public boolean isValid()
To be valid, the interval must either represent an instant or go forward in time.
public void readExternal(@Nonnull ObjectInput input) throws IOException
readExternal
in interface Externalizable
IOException
@Nonnull public TimeInterval.Builder setAfter(@Nonnull DateTime after)
after
- The after time.@Nonnull public TimeInterval.Builder setAt(@Nonnull DateTime at)
at
- The instant.@Nonnull public TimeInterval.Builder setBefore(@Nonnull DateTime before)
before
- The before time.@Nonnull public TimeInterval.Builder setNotAfter(@Nonnull DateTime notAfter)
notAfter
- The not after time.@Nonnull public TimeInterval.Builder setNotBefore(@Nonnull DateTime notBefore)
notBefore
- The not before time.public String toString()
toString
in class Object
@Nonnull public TimeInterval.Builder trim(@Nonnull TimeInterval limits)
limits
- The limits.public void writeExternal(@Nonnull ObjectOutput output) throws IOException
writeExternal
in interface Externalizable
IOException
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.