Add BindingTypes.QNAME
[mdsal.git] / binding / mdsal-binding-generator-util / src / main / java / org / opendaylight / mdsal / binding / model / util / AbstractBaseType.java
index 7347716be0e178f7cb256fbed5af6e70cb368532..4081790871a7ee8cbdfc40c5c81920fe74f21075 100644 (file)
@@ -7,22 +7,20 @@
  */
 package org.opendaylight.mdsal.binding.model.util;
 
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.binding.model.api.JavaTypeName;
 import org.opendaylight.mdsal.binding.model.api.Type;
 
 /**
- * It is used only as ancestor for other <code>Type</code>s
+ * It is used only as ancestor for other <code>Type</code>s.
  */
 public class AbstractBaseType implements Type {
     /**
      * Name of this <code>Type</code>.
      */
-    private final JavaTypeName identifier;
-
-    @Override
-    public final JavaTypeName getIdentifier() {
-        return this.identifier;
-    }
+    private final @NonNull JavaTypeName identifier;
 
     /**
      * Constructs the instance of this class with a JavaTypeName.
@@ -30,10 +28,12 @@ public class AbstractBaseType implements Type {
      * @param identifier for this <code>Type</code>
      */
     protected AbstractBaseType(final JavaTypeName identifier) {
-        if (identifier == null) {
-            throw new IllegalArgumentException("Identifier for Generated Type cannot be null!");
-        }
-        this.identifier = identifier;
+        this.identifier = requireNonNull(identifier);
+    }
+
+    @Override
+    public final JavaTypeName getIdentifier() {
+        return this.identifier;
     }
 
     @Override