Package it.tidalwave.util
Interface IdFactory
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A factory for creating a new, unique
Id for an object.- Author:
- Fabrizio Giudici
- Status: stable API
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptioncreateId()Creates a new id.default IdCreates a new id for an object of the given class.default IdCreates a new id for the given object of the given class.static IdFactoryCreates a new mock factory, useful for testing, that returns mock UUIDs based on a sequential counter.
-
Field Details
-
_IdFactory_
-
DEFAULT
A default implementation that uses UUID.- Since:
- 3.2-ALPHA-19
-
-
Method Details
-
createMock
Creates a new mock factory, useful for testing, that returns mock UUIDs based on a sequential counter.- Returns:
- the new factory
- Since:
- 3.2-ALPHA-23
-
createId
Creates a new id.- Returns:
- the new id
-
createId
Creates a new id for an object of the given class.- Parameters:
objectClass- the class of the object for which theIdis created- Returns:
- the new id
-
createId
Creates a new id for the given object of the given class. This method allows to explicitly pass aClassfor cases in which theobjectimplements multiple interfaces and one wants to specify the referenced one.- Parameters:
objectClass- the class of the object for which theIdis createdobject- the object for which theId- Returns:
- the new id
-