Skip to content

Commit

Permalink
PolyString fallbackTranslation
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Mar 4, 2019
1 parent 7800498 commit 4afd035
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
Expand Up @@ -42,6 +42,7 @@
@XmlType(name = "PolyStringTranslationType", propOrder = {
"key",
"fallback",
"fallbackTranslation",
"argument"
})
public class PolyStringTranslationType implements Serializable, Cloneable {
Expand All @@ -52,6 +53,7 @@ public class PolyStringTranslationType implements Serializable, Cloneable {
@XmlElement(required = true)
protected String key;
protected String fallback;
protected PolyStringTranslationType fallbackTranslation;
protected final List<PolyStringTranslationArgumentType> argument = new ArrayList<>();

public String getKey() {
Expand All @@ -69,17 +71,26 @@ public String getFallback() {
public void setFallback(String fallback) {
this.fallback = fallback;
}

public PolyStringTranslationType getFallbackTranslation() {
return fallbackTranslation;
}

public void setFallbackTranslation(PolyStringTranslationType fallbackTranslation) {
this.fallbackTranslation = fallbackTranslation;
}

public List<PolyStringTranslationArgumentType> getArgument() {
return argument;
}

@Override
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((argument == null) ? 0 : argument.hashCode());
result = prime * result + ((fallback == null) ? 0 : fallback.hashCode());
result = prime * result + ((fallbackTranslation == null) ? 0 : fallbackTranslation.hashCode());
result = prime * result + ((key == null) ? 0 : key.hashCode());
return result;
}
Expand All @@ -103,6 +114,11 @@ public boolean equals(Object obj) {
return false;
} else if (!fallback.equals(other.fallback))
return false;
if (fallbackTranslation == null) {
if (other.fallbackTranslation != null)
return false;
} else if (!fallbackTranslation.equals(other.fallbackTranslation))
return false;
if (key == null) {
if (other.key != null)
return false;
Expand All @@ -111,16 +127,20 @@ public boolean equals(Object obj) {
return true;
}

@Override
@Override
public String toString() {
return "PolyStringTranslationType(key=" + key + ", fallback=" + fallback + ", argument=" + argument + ")";
return "PolyStringTranslationType(key=" + key + ", fallback=" + fallback + ", fallbackTranslation="
+ fallbackTranslation + ", argument=" + argument + ")";
}

@Override
public PolyStringTranslationType clone() {
PolyStringTranslationType cloned = new PolyStringTranslationType();
cloned.setKey(getKey());
cloned.setFallback(getFallback());
if (getFallbackTranslation() != null) {
cloned.setFallbackTranslation(getFallbackTranslation().clone());
}
for (PolyStringTranslationArgumentType argument : getArgument()) {
cloned.getArgument().add(argument.clone());
}
Expand Down
7 changes: 7 additions & 0 deletions infra/prism-impl/src/main/resources/xml/ns/public/types-3.xsd
Expand Up @@ -133,6 +133,13 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="fallbackTranslation" type="tns:PolyStringTranslationType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Translation to be used in case that the key is not found in the localization catalogs.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="argument" type="tns:PolyStringTranslationArgumentType" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
Expand Down

0 comments on commit 4afd035

Please sign in to comment.