diff --git a/src/main/java/de/marhali/easyi18n/model/KeyPathConverter.java b/src/main/java/de/marhali/easyi18n/model/KeyPathConverter.java deleted file mode 100644 index 1bc5fcd..0000000 --- a/src/main/java/de/marhali/easyi18n/model/KeyPathConverter.java +++ /dev/null @@ -1,70 +0,0 @@ -package de.marhali.easyi18n.model; - -import com.intellij.openapi.project.Project; - -import de.marhali.easyi18n.settings.ProjectSettingsService; - -import org.jetbrains.annotations.NotNull; - -import java.util.regex.Pattern; - -/** - * Responsible for mapping {@link KeyPath} into single string and backwards. - * If nesting is enabled the delimiter within a section is escaped otherwise the delimiter between the key sections. - * @author marhali - */ -@Deprecated // Replacement moved to utils -public class KeyPathConverter { - - private final boolean nestKeys; - - public KeyPathConverter(boolean nestKeys) { - this.nestKeys = nestKeys; - } - - public KeyPathConverter(@NotNull Project project) { - this(ProjectSettingsService.get(project).getState().isNestedKeys()); - } - - public @NotNull String concat(@NotNull KeyPath path) { - StringBuilder builder = new StringBuilder(); - - for(String section : path) { - if(builder.length() > 0) { - if(!this.nestKeys) { - builder.append("\\\\"); - } - - builder.append(KeyPath.DELIMITER); - } - - if(this.nestKeys) { - builder.append(section.replace(KeyPath.DELIMITER, "\\\\" + KeyPath.DELIMITER)); - } else { - builder.append(section); - } - } - - return builder.toString(); - } - - public @NotNull KeyPath split(@NotNull String concatPath) { - String[] sections = concatPath.split(this.nestKeys ? - "(? { - - public KeyPath() {} - - public KeyPath(@Nullable String... path) { - super.addAll(List.of(path)); - } - - public KeyPath(@NotNull List path) { - super(path); - } - - public KeyPath(@NotNull KeyPath path, @Nullable String... pathToAppend) { - this(path); - super.addAll(List.of(pathToAppend)); - } - - @Override - public String toString() { - // Just a simple array view (e.g. [first, second]) - use KeyPathConverter to properly convert a key path - return super.toString(); - } -} diff --git a/src/main/java/de/marhali/easyi18n/model/translation/Translation.java b/src/main/java/de/marhali/easyi18n/model/translation/Translation.java deleted file mode 100644 index 5636c86..0000000 --- a/src/main/java/de/marhali/easyi18n/model/translation/Translation.java +++ /dev/null @@ -1,54 +0,0 @@ -package de.marhali.easyi18n.model.translation; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Represents a translation with defined key and locale values. - * - * @author marhali - */ -public class Translation { - - private final @NotNull KeyPath key; - private @Nullable TranslationValue value; - - /** - * Constructs a new translation instance. - * @param key Absolute key path - * @param value Values to set - nullable to indicate removal - */ - public Translation(@NotNull KeyPath key, @Nullable TranslationValue value) { - this.key = key; - this.value = value; - } - - /** - * @return Absolute key path - */ - public @NotNull KeyPath getKey() { - return key; - } - - /** - * @return values - nullable to indicate removal - */ - public @Nullable TranslationValue getValue() { - return value; - } - - /** - * @param value Values to set - nullable to indicate removal - */ - public void setValue(@Nullable TranslationValue value) { - this.value = value; - } - - @Override - public String toString() { - return "Translation{" + - "key=" + key + - ", value=" + value + - '}'; - } -} \ No newline at end of file