BUG-865: deprecate pre-Beryllium parser elements
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / builder / impl / ModuleImpl.java
index f6f152fd35b2dbe441e73d9d01bed6085063b9e2..fa4a8ae25aef164cf528413466411059d6852981 100644 (file)
@@ -1,7 +1,14 @@
+/*
+ * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.yangtools.yang.parser.builder.impl;
 
 import static com.google.common.base.Preconditions.checkNotNull;
-
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import java.net.URI;
@@ -9,6 +16,7 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.NavigableSet;
+import java.util.Objects;
 import java.util.Set;
 import java.util.TreeSet;
 import org.opendaylight.yangtools.concepts.Immutable;
@@ -27,6 +35,10 @@ import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainer;
 import org.opendaylight.yangtools.yang.parser.builder.util.Comparators;
 
+/**
+ * @deprecated Pre-Beryllium implementation, scheduled for removal.
+ */
+@Deprecated
 public final class ModuleImpl extends AbstractDocumentedDataNodeContainer implements Module, Immutable {
 
     private final QNameModule qnameModule;
@@ -67,7 +79,7 @@ public final class ModuleImpl extends AbstractDocumentedDataNodeContainer implem
         this.prefix = builder.getPrefix();
 
         this.qnameModule = QNameModule.create(builder.getNamespace(),
-                builder.getRevision() == null ? null : new Date(builder.getRevision().getTime()));
+                builder.getRevision() == null ? null : new Date(builder.getRevision().getTime())).intern();
         this.yangVersion = builder.getYangVersion();
         this.organization = builder.getOrganization();
         this.contact = builder.getContact();
@@ -182,8 +194,8 @@ public final class ModuleImpl extends AbstractDocumentedDataNodeContainer implem
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        result = prime * result + ((name == null) ? 0 : name.hashCode());
-        result = prime * result + ((yangVersion == null) ? 0 : yangVersion.hashCode());
+        result = prime * result + Objects.hashCode(name);
+        result = prime * result + Objects.hashCode(yangVersion);
         result = prime * result + qnameModule.hashCode();
         return result;
     }