blob: 710b60635a9beac24ac8bc26834e13d81eb7afa7 [file] [log] [blame]
///////////////////////////////////////////////////////////////
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
///////////////////////////////////////////////////////////////
[[library-uid, UID Library]]
= UID =
[devstatus]
--------------
source=libraries/uid/dev-status.xml
--------------
This library provides Services to easily generate unique identifiers and sequences of numbers.
include::../../build/docs/buildinfo/artifact.txt[]
== Unique Identifiers ==
Assembly is done using the provided Assembler:
[snippet,java]
----
source=libraries/uid/src/test/java/org/qi4j/library/uid/DocumentationSupport.java
tag=uuid-assembly
----
Usage is quite simple:
[snippet,java]
----
source=libraries/uid/src/test/java/org/qi4j/library/uid/DocumentationSupport.java
tag=uuid-usage
----
== Sequencing ==
Sequencing is used to automatically generate a sequence of numbers.
The algorithm is that `currentSequenceValue` is the number that was last returned in a `newSequenceValue` call, and will
initially be zero. Persisting Sequencing services defines "initially" as the first run ever, as subsequent starts may
retrieve the `currentSequenceValue` from an EntityStore.
=== Transient Sequences ===
Assembly is done using the provided Assembler:
[snippet,java]
----
source=libraries/uid/src/test/java/org/qi4j/library/uid/DocumentationSupport.java
tag=seq-assembly
----
Usage is quite simple:
[snippet,java]
----
source=libraries/uid/src/test/java/org/qi4j/library/uid/DocumentationSupport.java
tag=seq-usage
----
=== Persisted Sequences ===
Assembly is done using the provided Assembler:
[snippet,java]
----
source=libraries/uid/src/test/java/org/qi4j/library/uid/DocumentationSupport.java
tag=perseq-assembly
----
Usage is quite simple:
[snippet,java]
----
source=libraries/uid/src/test/java/org/qi4j/library/uid/DocumentationSupport.java
tag=seq-usage
----