diff --git a/src/main/java/de/marhali/easyi18n/model/KeyPath.java b/src/main/java/de/marhali/easyi18n/model/KeyPath.java index 600a66a..17e4d1a 100644 --- a/src/main/java/de/marhali/easyi18n/model/KeyPath.java +++ b/src/main/java/de/marhali/easyi18n/model/KeyPath.java @@ -13,6 +13,7 @@ import java.util.regex.Pattern; * The respective layer (io, presentation) is responsible for using the correct mapping mechanism. * @author marhali */ +@Deprecated public class KeyPath extends ArrayList { public static final String DELIMITER = "."; diff --git a/src/main/java/de/marhali/easyi18n/model/translation/KeyPath.java b/src/main/java/de/marhali/easyi18n/model/translation/KeyPath.java new file mode 100644 index 0000000..5d89f32 --- /dev/null +++ b/src/main/java/de/marhali/easyi18n/model/translation/KeyPath.java @@ -0,0 +1,37 @@ +package de.marhali.easyi18n.model.translation; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; + +/** + * Represents the absolute key path for a desired translation. + * The key could be based one or many sections. + * Classes implementing this structure need to take care on how to layer translations paths. + * @author marhali + */ +public class KeyPath extends ArrayList { + + 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(); + } +}