From 69de594da6ebc28b2f6b231cdff581b7f8f1bdbd Mon Sep 17 00:00:00 2001 From: Jens Pelzetter Date: Fri, 22 May 2020 19:26:22 +0200 Subject: [PATCH] Updated JavaDoc of LocalizedString --- .../org/libreccm/l10n/LocalizedString.java | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/ccm-core/src/main/java/org/libreccm/l10n/LocalizedString.java b/ccm-core/src/main/java/org/libreccm/l10n/LocalizedString.java index cd0e96947..70526b96f 100644 --- a/ccm-core/src/main/java/org/libreccm/l10n/LocalizedString.java +++ b/ccm-core/src/main/java/org/libreccm/l10n/LocalizedString.java @@ -37,35 +37,38 @@ import java.util.Set; import static org.libreccm.l10n.L10NConstants.L10N_XML_NS; +import org.hibernate.annotations.Type; + import javax.json.Json; import javax.json.JsonObject; import javax.json.JsonObjectBuilder; +import javax.persistence.Column; /** - * A helper class for localisable string properties. This class is declared as - * embeddable, so that it can be used in every other entity. The localised + * A helper class for localisable string properties. For using this class a + * Hibernate User type is provided ({@link LocalizedStringType} which maps + * instances of this class to a JSONB column in the database. The localised * values are stored in a {@link Map}. This class is not designed to be * overwritten. But because it is an entity class we can't make the class final. * + * To use this class you must annoate this property with the {@link Type} + * annotation provided by hibernate. The {@link Column} annotation can used + * a usual to set the name of the database column. Example + * + *
+ *  @Column(name = "DESCRIPTION")
+    @Type(type = "org.libreccm.l10n.LocalizedStringType")
+    private LocalizedString description;
+ * 
+ * * @author Jens Pelzetter */ -//@Embeddable @XmlRootElement(name = "localized-string", namespace = L10N_XML_NS) @XmlAccessorType(XmlAccessType.FIELD) public class LocalizedString implements Serializable { private static final long serialVersionUID = 7378282657084330425L; - /** - * The localised values of the string. - */ -// @ElementCollection(fetch = FetchType.LAZY) -// @MapKeyColumn(name = "LOCALE") -// @Column(name = "LOCALIZED_VALUE") -// @Basic -// @Lob -// @Type(type = "org.hibernate.type.TextType") -// @Field @XmlElement(name = "values", namespace = L10N_XML_NS) @XmlJavaTypeAdapter(LocalizedStringValuesAdapter.class) private Map values; @@ -228,7 +231,7 @@ public class LocalizedString implements Serializable { return builder; } - + public JsonObject toJson() { return buildJson().build(); }