From 9e78a3952a82700649a8e71893d3dd77ec69fe2f Mon Sep 17 00:00:00 2001 From: Andrey Date: Mon, 3 Jul 2023 11:54:19 -0400 Subject: [PATCH] refactoring: extract method --- .../java/com/rusefi/output/FileJavaFieldsConsumer.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/java_tools/configuration_definition_base/src/main/java/com/rusefi/output/FileJavaFieldsConsumer.java b/java_tools/configuration_definition_base/src/main/java/com/rusefi/output/FileJavaFieldsConsumer.java index ea322036d0..e4159881c0 100644 --- a/java_tools/configuration_definition_base/src/main/java/com/rusefi/output/FileJavaFieldsConsumer.java +++ b/java_tools/configuration_definition_base/src/main/java/com/rusefi/output/FileJavaFieldsConsumer.java @@ -3,7 +3,7 @@ package com.rusefi.output; import com.rusefi.ReaderState; import com.rusefi.ToolUtil; import com.rusefi.util.LazyFile; -import com.rusefi.util.LazyFileImpl; +import org.jetbrains.annotations.NotNull; import java.io.File; import java.io.IOException; @@ -23,7 +23,12 @@ public class FileJavaFieldsConsumer extends JavaFieldsConsumer { super(state, baseOffset); javaFields = fileFactory.create(javaDestination); String className = new File(javaDestination).getName(); - this.className = className.substring(0, className.indexOf('.')); + this.className = remoteExtension(className); + } + + @NotNull + public static String remoteExtension(String fileNameWithExtension) { + return fileNameWithExtension.substring(0, fileNameWithExtension.indexOf('.')); } @Override