Announcing uuid, a Java Library for UUID Validation

As noted in Validating UUIDs with Regular Expressions in Java, I work with UUIDs a fair bit, for various means of random identifiers.

While working at Capital One, we got to the point that we were duplicating the regex in quite a few places, so I added to the team's 10% self-directed development time the act of creating a library that could be shared between services, as we had a pretty good community internally of building and maintaining common libraries.

I'm not sure if it's been implemented yet, but I've decided to build my own Open Source version, which can be found at uuid and on Maven Central under the group me.jvt.uuid, as I want to use it within my own projects, both in and out of work.

As well as producing a uuid-core module which includes the Pattern and Strings that define the regular expression, there's also a uuid-validation-javax library that implements bean validation using javax-validation, and allows you to annotate your data types i.e.:

import me.jvt.uuid.validation.Uuid;

public class DataClass {
  @Uuid public String uuid;
}

I am also planning on releasing a module that targets jakarta-validation.

If there's anything else you can think of that may be useful, please add it to the issue tracker!

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#java #uuid #jsr380 #bean-validation.

This post was filed under articles.

Related Posts

Other posts you may be interested in:

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.