(no commit message)
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / common / LanguageString.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9
10 package eu.etaxonomy.cdm.model.common;
11
12 import javax.persistence.Entity;
13 import javax.xml.bind.annotation.XmlAccessType;
14 import javax.xml.bind.annotation.XmlAccessorType;
15 import javax.xml.bind.annotation.XmlType;
16
17 import org.apache.log4j.Logger;
18
19 /**
20 * @author m.doering
21 * @version 1.0
22 * @created 08-Nov-2007 13:06:32
23 */
24 @XmlAccessorType(XmlAccessType.FIELD)
25 @XmlType(name = "LanguageString")
26 @Entity
27 public class LanguageString extends LanguageStringBase{
28 static Logger logger = Logger.getLogger(LanguageString.class);
29
30 public static LanguageString NewInstance(String text, Language language){
31 return new LanguageString(text, language);
32 }
33
34 protected LanguageString() {
35 super();
36 }
37
38 protected LanguageString(String text, Language language) {
39 super(text, language);
40 }
41
42 /* (non-Javadoc)
43 * @see eu.etaxonomy.cdm.model.common.CdmBase#toString()
44 */
45 @Override
46 public String toString() {
47 if (text == null){
48 return super.toString() + "null";
49 }else{
50 String languagePart = "";
51 if (this.language != null){
52 languagePart = "(" + this.language.toString() + ")";
53 }
54 if (text.length() > 20){
55 return text.substring(0, 20) + "..." + languagePart;
56 }else{
57 return text + languagePart;
58 }
59 }
60 }
61
62
63
64 }