deprecate translation update and add replacement

This commit is contained in:
Marcel Haßlinger 2021-11-04 17:59:54 +01:00
parent 760fc287e9
commit 5aa46593e0
2 changed files with 91 additions and 0 deletions

View File

@ -0,0 +1,47 @@
package de.marhali.easyi18n.model;
import org.jetbrains.annotations.Nullable;
/**
* Represents an update for a translated I18n-Key. Supports key creation, manipulation and deletion.
* @author marhali
*/
@Deprecated
public class LegacyTranslationUpdate {
private final @Nullable LegacyKeyedTranslation origin;
private final @Nullable LegacyKeyedTranslation change;
public LegacyTranslationUpdate(@Nullable LegacyKeyedTranslation origin, @Nullable LegacyKeyedTranslation change) {
this.origin = origin;
this.change = change;
}
public LegacyKeyedTranslation getOrigin() {
return origin;
}
public LegacyKeyedTranslation getChange() {
return change;
}
public boolean isCreation() {
return origin == null;
}
public boolean isDeletion() {
return change == null;
}
public boolean isKeyChange() {
return origin != null && change != null && !origin.getKey().equals(change.getKey());
}
@Override
public String toString() {
return "TranslationUpdate{" +
"origin=" + origin +
", change=" + change +
'}';
}
}

View File

@ -1,4 +1,48 @@
package de.marhali.easyi18n.model; package de.marhali.easyi18n.model;
import org.jetbrains.annotations.Nullable;
/**
* Represents an update for a translated i18n key.
* Supports translation creation, manipulation and deletion.
*
* @author marhali
*/
public class TranslationUpdate { public class TranslationUpdate {
private final @Nullable KeyedTranslation origin;
private final @Nullable KeyedTranslation change;
public TranslationUpdate(@Nullable KeyedTranslation origin, @Nullable KeyedTranslation change) {
this.origin = origin;
this.change = change;
}
public @Nullable KeyedTranslation getOrigin() {
return origin;
}
public @Nullable KeyedTranslation getChange() {
return change;
}
public boolean isCreation() {
return this.origin == null;
}
public boolean isDeletion() {
return this.change == null;
}
public boolean isKeyChange() {
return this.origin != null && this.change != null && !this.origin.getKey().equals(this.change.getKey());
}
@Override
public String toString() {
return "TranslationUpdate{" +
"origin=" + origin +
", change=" + change +
'}';
}
} }