fix(muscript): use String.formatted instead of concatenation

This commit is contained in:
Johannes Frohnmeyer 2024-04-07 15:35:14 +02:00
parent 8bddb34c22
commit 3361ee9df1
Signed by: Johannes
GPG Key ID: E76429612C2929F4
1 changed files with 2 additions and 3 deletions

View File

@ -1,13 +1,12 @@
package io.gitlab.jfronny.muscript.data.dynamic;
public class DynamicTypeConversionException extends RuntimeException {
private static final String MESSAGE1 = "Could not convert dynamic of type ";
private static final String MESSAGE2 = " to ";
private static final String MESSAGE = "Could not convert dynamic of type %s to %s";
private final String target;
private final String actual;
public DynamicTypeConversionException(String target, Dynamic dynamic) {
super(MESSAGE1 + (dynamic == null ? "null" : dynamic.getClass().getSimpleName()) + MESSAGE2 + target);
super(MESSAGE.formatted(dynamic == null ? "null" : dynamic.getClass().getSimpleName(), target));
this.target = target;
this.actual = dynamic == null ? "null" : dynamic.getClass().getSimpleName();
}