Avoid String allocations with Assert.isTrue()
This commit is contained in:
@@ -86,7 +86,7 @@ public class FileSystemGeneratedFiles implements GeneratedFiles {
|
||||
Assert.notNull(content, "'content' must not be null");
|
||||
Path root = this.roots.apply(kind).toAbsolutePath().normalize();
|
||||
Path relativePath = root.resolve(path).toAbsolutePath().normalize();
|
||||
Assert.isTrue(relativePath.startsWith(root), () -> "'path' must be relative");
|
||||
Assert.isTrue(relativePath.startsWith(root), "'path' must be relative");
|
||||
try {
|
||||
try (InputStream inputStream = content.getInputStream()) {
|
||||
Files.createDirectories(relativePath.getParent());
|
||||
|
||||
@@ -161,8 +161,7 @@ public interface GeneratedFiles {
|
||||
|
||||
private static String getClassNamePath(String className) {
|
||||
Assert.hasLength(className, "'className' must not be empty");
|
||||
Assert.isTrue(isJavaIdentifier(className),
|
||||
"'className' must be a valid identifier");
|
||||
Assert.isTrue(isJavaIdentifier(className), "'className' must be a valid identifier");
|
||||
return ClassUtils.convertClassNameToResourcePath(className) + ".java";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user