Add constructor for term type only
authorPatrick Plitzner <p.plitzner@bgbm.org>
Thu, 2 May 2019 15:56:08 +0000 (17:56 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Thu, 2 May 2019 15:56:08 +0000 (17:56 +0200)
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/term/DefinedTerm.java

index 234499bdc3de6fb5add5690df7ff92f962047c95..c4442c455b81ceba21aeecf4728ced40ae83b9c6 100644 (file)
@@ -80,15 +80,22 @@ public class DefinedTerm extends DefinedTermBase<DefinedTerm> implements Compara
                }
        }
 
+          /**
+     * Creates a new empty {@link DefinedTerm} instance.
+     *
+     * @see #NewInstance(String, String, String)
+     */
+    public static DefinedTerm NewInstance(TermType termType) {
+        return new DefinedTerm(termType);
+    }
+
        public static DefinedTerm NewInstance(TermType termType, Set<Representation> representations){
            DefinedTerm term = null;
            for (Representation representation : representations) {
             if(term==null){
-                term = new DefinedTerm(termType, representation.getDescription(), representation.getLabel(), representation.getAbbreviatedLabel());
-            }
-            else{
-                term.addRepresentation(representation);
+                term = new DefinedTerm(termType);
             }
+            term.addRepresentation(representation);
         }
            return term;
        }
@@ -140,6 +147,10 @@ public class DefinedTerm extends DefinedTermBase<DefinedTerm> implements Compara
        @Deprecated
        protected DefinedTerm(){super(TermType.Unknown);}
 
+       protected DefinedTerm(TermType termType){
+           super(termType);
+       }
+
        public DefinedTerm(TermType type, String description, String label, String labelAbbrev) {
                super(type, description, label, labelAbbrev);
        }