Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,45 @@ jobs:

steps:
- name: Checkout source
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Set up JDK
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
java-version: '17'
java-version: '25'
distribution: 'zulu'
cache: maven

- name: Show versions
run: java -version && ./mvnw -version && gpg --version

- name: Cache SonarCloud packages
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache Maven packages
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
uses: crazy-max/ghaction-import-gpg@v7
with:
gpg_private_key: ${{ secrets.OSS_SONATYPE_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.OSS_SONATYPE_GPG_PASSPHRASE }}

- name: Build with Maven
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OSS_SONATYPE_USERNAME: michael-schnell
OSS_SONATYPE_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
OSS_SONATYPE_TOKEN: ${{ secrets.OSS_SONATYPE_TOKEN }}
OSS_SONATYPE_GPG_PASSPHRASE: ${{ secrets.OSS_SONATYPE_GPG_PASSPHRASE }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./mvnw clean deploy jacoco:report sonar:sonar -U -B -P sonatype-oss-release --file pom.xml -s settings.xml
run: ./mvnw clean deploy jacoco:report sonar:sonar -U -B -P central-sonatype-release --file pom.xml -s settings.xml
10 changes: 10 additions & 0 deletions .mvn/jvm.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
Binary file removed .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
21 changes: 3 additions & 18 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
# 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.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
wrapperVersion=3.3.4
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.15/apache-maven-3.9.15-bin.zip
4 changes: 4 additions & 0 deletions release-notes.md → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## 0.16.0
- Added new [Utils4J](src/main/java/org/fuin/utils4j/Utils4J.java) method to encode a UUID to a short string and back
- Added [JSpecify](https://jspecify.dev/) and [NullAway](https://github.com/uber/nullaway)

## 0.15.0
- Added new [JandexUtils](src/main/java/org/fuin/utils4j/jandex/JandexUtils.java) methods
- Added new [TechnicalId](src/main/java/org/fuin/utils4j/TechnicalId.java) tag interface.
Expand Down
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ A small Java library that contains several helpful utility classes.

[![Java Maven Build](https://github.com/fuinorg/utils4j/actions/workflows/maven.yml/badge.svg)](https://github.com/fuinorg/utils4j/actions/workflows/maven.yml)
[![Coverage Status](https://sonarcloud.io/api/project_badges/measure?project=org.fuin%3Autils4j&metric=coverage)](https://sonarcloud.io/dashboard?id=org.fuin%3Autils4j)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.fuin/utils4j/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.fuin/utils4j/)
[![Maven Central](https://img.shields.io/maven-central/v/org.fuin/utils4j.svg)](https://central.sonatype.com/artifact/org.fuin/utils4j)
[![Javadocs](https://www.javadoc.io/badge/org.fuin/utils4j.svg)](https://www.javadoc.io/doc/org.fuin/utils4j)
[![LGPLv3 License](http://img.shields.io/badge/license-LGPLv3-blue.svg)](https://www.gnu.org/licenses/lgpl.html)
[![Java Development Kit 17](https://img.shields.io/badge/JDK-17-green.svg)](https://openjdk.java.net/projects/jdk/17/)

## Versions
- [0.15.0](release-notes.md#0150)
- [0.14.0](release-notes.md#0140)
- See [Release Notes](CHANGELOG.md)
- 0.13.x (or later) = **Java 17**
- 0.12.0 = **Java 11** with new **jakarta** namespace
- 0.11.x = **Java 11** before namespace change from 'javax' to 'jakarta'
Expand All @@ -32,6 +31,7 @@ A small Java library that contains several helpful utility classes.
* [Wait for code to finish](#wait-for-code-to-finish) (Deprecated in favour of [Awaitility](https://github.com/awaitility/awaitility))
* [Find all JARs and classes in the classpath](#find-all-jars-and-classes-in-the-classpath)
* [Analyze classes in the classpath with Jandex](#analyze-classes-in-the-classpath-with-jandex)
* [Convert a UUID to 22 character string and back](#convert-uuid-to-22-character-string-and-back)

* * *

Expand Down Expand Up @@ -269,6 +269,20 @@ A test that shows the usage can be found here: [JandexUtilsTest](src/test/java/o
</dependency>
```

### Convert UUID to 22 character string and back
Normally UUID as string use 36 characters. This functions use a 22 character representation.
The UUID's MSB/LSB are stored as Base64 encoded string and replaces "+" with "-" and "/" with "_".
This may be helpful in situations where the standard 36 characters representation is too long.

```Java
UUID uuid1 = UUID.fromString("c9a5ab65-0fae-4ff8-8858-e06ddaf595e7");
String str = Utils4J.uuid2ShortStr(uuid1);
// MSB/LSB Base64 encoded would be: "yaWrZQ+uT/iIWOBt2vWV5w"
System.out.println(str); // Prints "yaWrZQ-uT_iIWOBt2vWV5w"
UUID uuid2 = Utils4J.shortStr2uuid(str);
System.out.println(uuid2); // Prints "c9a5ab65-0fae-4ff8-8858-e06ddaf595e7"
```


* * *

Expand Down
Loading