Package com.github.f4b6a3.uuid.strategy
Interface NodeIdentifierStrategy
-
- All Known Implementing Classes:
DefaultNodeIdentifierStrategy,FixedNodeIdentifierStrategy,HashNodeIdentifierStrategy,MacNodeIdentifierStrategy,RandomNodeIdentifierStrategy
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface NodeIdentifierStrategy
Strategy that provides node identifiers for time-based UUIDs. It also provides static helper methods.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description longgetNodeIdentifier()static longgetRandomNodeIdentifier()Return a random generated node identifier.static booleanisMulticastNodeIdentifier(long nodeIdentifier)Checks if a node identifier is multicast.static longsetMulticastNodeIdentifier(long nodeIdentifier)Sets the the multicast bit ON to indicate that it's NOT a real MAC address.static longsetNodeIdentifier(long nodeIdentifier)The output is truncated to fit the node identifier bit length.
-
-
-
Method Detail
-
getNodeIdentifier
long getNodeIdentifier()
-
getRandomNodeIdentifier
static long getRandomNodeIdentifier()
Return a random generated node identifier.- Returns:
- a random multicast node identifier
-
setNodeIdentifier
static long setNodeIdentifier(long nodeIdentifier)
The output is truncated to fit the node identifier bit length.- Parameters:
nodeIdentifier- a node identifier- Returns:
- a node identifier
-
setMulticastNodeIdentifier
static long setMulticastNodeIdentifier(long nodeIdentifier)
Sets the the multicast bit ON to indicate that it's NOT a real MAC address. The output is truncated to fit the node identifier bit length.- Parameters:
nodeIdentifier- a node identifier- Returns:
- a multicast node identifier
-
isMulticastNodeIdentifier
static boolean isMulticastNodeIdentifier(long nodeIdentifier)
Checks if a node identifier is multicast.- Parameters:
nodeIdentifier- a node identifier- Returns:
- true if is multicast
-
-