Package org.wikidata.wdtk.wikibaseapi
Class RandomGuidGenerator
java.lang.Object
org.wikidata.wdtk.wikibaseapi.RandomGuidGenerator
- All Implemented Interfaces:
GuidGenerator
Generates fresh hashes for new statements, snaks or references,
based on Java's own random generator (java.util.UUID).
- Author:
- antonin
-
Field Summary
Fields inherited from interface org.wikidata.wdtk.wikibaseapi.GuidGenerator
STATEMENT_GUID_SEPARATOR
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfreshStatementId
(String entityId) Generates a fresh statement id.
-
Constructor Details
-
RandomGuidGenerator
public RandomGuidGenerator()
-
-
Method Details
-
freshStatementId
Generates a fresh statement id. This consists of a first part with the entity id of the item the statement belongs to, plus a random hash of the form /^\{?[A-Z\d]{8}-[A-Z\d]{4}-[A-Z\d]{4}-[A-Z\d]{4}-[A-Z\d]{12}\}?\z/- Specified by:
freshStatementId
in interfaceGuidGenerator
- Parameters:
entityId
- the entity the statement belongs to- Returns:
- a fresh UUID in the required format.
-