Uniform Resource Name (URN)
com.jcabi.urn.URN
is an immutable implementation of a Uniform Resource Name (URN) according to RFC 2141:
import com.jcabi.urn.URN; public class Main { public static void main(String[] args) { URN urn = new URN("urn:test:my-example"); assert urn.nid().equals("test"); assert urn.nss().equals("my-example"); } }
The only dependency you need is (you can also download jcabi-urn-0.10.0.jar
and add it to the classpath):
<dependency> <groupId>com.jcabi</groupId> <artifactId>jcabi-urn</artifactId> <version>0.10.0</version> </dependency>
Cutting Edge Version
If you want to use current version of the product, you can do it with this configuration in your pom.xml
:
<repositories> <repository> <id>oss.sonatype.org</id> <url>https://oss.sonatype.org/content/repositories/snapshots/</url> </repository> </repositories> <dependencies> <dependency> <groupId>com.jcabi</groupId> <artifactId>jcabi-urn</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies>