Module com.github.f4b6a3.uuid
Package com.github.f4b6a3.uuid.factory
Class AbstTimeBasedFactory.Builder<T,B extends AbstTimeBasedFactory.Builder<T,B>>
- java.lang.Object
-
- com.github.f4b6a3.uuid.factory.AbstTimeBasedFactory.Builder<T,B>
-
- Direct Known Subclasses:
DceSecurityFactory.Builder,TimeBasedFactory.Builder,TimeOrderedFactory.Builder
- Enclosing class:
- AbstTimeBasedFactory
public abstract static class AbstTimeBasedFactory.Builder<T,B extends AbstTimeBasedFactory.Builder<T,B>> extends Object
Abstract builder for creating a time-based factory.
-
-
Field Summary
Fields Modifier and Type Field Description protected ClockSeqFunctionclockseqFunctionThe clock sequence function.protected NodeIdFunctionnodeidFunctionThe node function.protected TimeFunctiontimeFunctionThe time function.
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Tbuild()Finish the factory building.protected ClockSeqFunctiongetClockSeqFunction()Get the clock sequence function.protected NodeIdFunctiongetNodeIdFunction()Get the node function.protected TimeFunctiongetTimeFunction()Get the time function.BwithClockSeq(byte[] clockseq)Set a fixed clock sequence.BwithClockSeq(long clockseq)Set the fixed clock sequence.BwithClockSeqFunction(ClockSeqFunction clockseqFunction)Set the clock sequence functionBwithHashNodeId()Set the node function to hash strategy.BwithInstant(Instant instant)Set the fixed instant.BwithMacNodeId()Set the node function to MAC strategy.BwithNodeId(byte[] nodeid)Set a fixed nodeBwithNodeId(long nodeid)Set a fixed node.BwithNodeIdFunction(NodeIdFunction nodeidFunction)Set the node functionBwithRandomNodeId()Set the node function to random strategy.BwithTimeFunction(TimeFunction timeFunction)Set the time function.
-
-
-
Field Detail
-
timeFunction
protected TimeFunction timeFunction
The time function.
-
nodeidFunction
protected NodeIdFunction nodeidFunction
The node function.
-
clockseqFunction
protected ClockSeqFunction clockseqFunction
The clock sequence function.
-
-
Method Detail
-
getTimeFunction
protected TimeFunction getTimeFunction()
Get the time function.- Returns:
- a function
-
getNodeIdFunction
protected NodeIdFunction getNodeIdFunction()
Get the node function.- Returns:
- a function
-
getClockSeqFunction
protected ClockSeqFunction getClockSeqFunction()
Get the clock sequence function.- Returns:
- a function
-
withTimeFunction
public B withTimeFunction(TimeFunction timeFunction)
Set the time function.- Parameters:
timeFunction- a function- Returns:
- the builder
-
withNodeIdFunction
public B withNodeIdFunction(NodeIdFunction nodeidFunction)
Set the node function- Parameters:
nodeidFunction- a function- Returns:
- the builder
-
withClockSeqFunction
public B withClockSeqFunction(ClockSeqFunction clockseqFunction)
Set the clock sequence function- Parameters:
clockseqFunction- a function- Returns:
- the builder
-
withInstant
public B withInstant(Instant instant)
Set the fixed instant.- Parameters:
instant- an instant- Returns:
- the builder
-
withClockSeq
public B withClockSeq(long clockseq)
Set the fixed clock sequence.- Parameters:
clockseq- a clock sequence- Returns:
- the builder
-
withClockSeq
public B withClockSeq(byte[] clockseq)
Set a fixed clock sequence.- Parameters:
clockseq- a clock sequence- Returns:
- the builder
-
withNodeId
public B withNodeId(long nodeid)
Set a fixed node.- Parameters:
nodeid- a node- Returns:
- the builder
-
withNodeId
public B withNodeId(byte[] nodeid)
Set a fixed node- Parameters:
nodeid- a node- Returns:
- the builder
-
withMacNodeId
public B withMacNodeId()
Set the node function to MAC strategy.- Returns:
- the builder
-
withHashNodeId
public B withHashNodeId()
Set the node function to hash strategy.- Returns:
- the builder
-
withRandomNodeId
public B withRandomNodeId()
Set the node function to random strategy.- Returns:
- the builder
-
build
public abstract T build()
Finish the factory building.- Returns:
- the built factory
-
-