BUG-614: migrate RuntimeGeneratedInvokerPrototype 33/7733/4
authorRobert Varga <rovarga@cisco.com>
Thu, 5 Jun 2014 11:09:41 +0000 (13:09 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Fri, 6 Jun 2014 11:02:13 +0000 (11:02 +0000)
Splits off RuntimeGeneratedInvokerPrototype DTO into java. There is no
reason it should be in xtend.

Change-Id: I625d44d398cfe72be21ac33d29986c736412970e
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RuntimeCodeGenerator.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RuntimeGeneratedInvokerPrototype.java [new file with mode: 0644]

index 465a1f7..d47c0f9 100644 (file)
@@ -7,38 +7,33 @@
  */
 package org.opendaylight.controller.sal.binding.codegen.impl
 
+import java.util.HashMap
+import java.util.HashSet
+import java.util.Map
+import java.util.WeakHashMap
 import javassist.ClassPool
-import org.opendaylight.yangtools.yang.binding.RpcService
-
 import javassist.CtClass
 import javassist.CtMethod
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
-import org.opendaylight.yangtools.yang.binding.annotations.RoutingContext
+import javassist.LoaderClassPath
+import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper
+import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory
+import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory.NotificationInvoker
+import org.opendaylight.yangtools.sal.binding.generator.util.ClassLoaderUtils
+import org.opendaylight.yangtools.sal.binding.generator.util.JavassistUtils
 import org.opendaylight.yangtools.yang.binding.BaseIdentity
-
-import java.util.Map
-import java.util.HashMap
-
-
-import org.opendaylight.yangtools.yang.binding.NotificationListener
+import org.opendaylight.yangtools.yang.binding.DataContainer
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
 import org.opendaylight.yangtools.yang.binding.Notification
+import org.opendaylight.yangtools.yang.binding.NotificationListener
+import org.opendaylight.yangtools.yang.binding.RpcImplementation
+import org.opendaylight.yangtools.yang.binding.RpcService
+import org.opendaylight.yangtools.yang.binding.annotations.QName
+import org.opendaylight.yangtools.yang.binding.annotations.RoutingContext
 
+import static org.opendaylight.yangtools.concepts.util.ClassLoaderUtils.*
 
-import static extension org.opendaylight.controller.sal.binding.codegen.YangtoolsMappingHelper.*
 import static extension org.opendaylight.controller.sal.binding.codegen.RuntimeCodeSpecification.*
-import java.util.HashSet
-import static org.opendaylight.yangtools.concepts.util.ClassLoaderUtils.*
-import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory
-import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory.NotificationInvoker
-import java.util.Set
-import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper
-import java.util.WeakHashMap
-import org.opendaylight.yangtools.yang.binding.annotations.QName
-import org.opendaylight.yangtools.yang.binding.DataContainer
-import org.opendaylight.yangtools.yang.binding.RpcImplementation
-import org.opendaylight.yangtools.sal.binding.generator.util.JavassistUtils
-import org.opendaylight.yangtools.sal.binding.generator.util.ClassLoaderUtils
-import javassist.LoaderClassPath
+import static extension org.opendaylight.controller.sal.binding.codegen.YangtoolsMappingHelper.*
 
 class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.codegen.RuntimeCodeGenerator, NotificationInvokerFactory {
 
@@ -275,16 +270,6 @@ package class RuntimeGeneratedInvoker implements NotificationInvoker {
     }
 }
 
-@Data
-package class RuntimeGeneratedInvokerPrototype {
-
-    @Property
-    val Set<Class<? extends Notification>> supportedNotifications;
-
-    @Property
-    val Class<? extends org.opendaylight.controller.sal.binding.api.NotificationListener<?>> protoClass;
-}
-
 package class RpcServiceMetadata {
 
     @Property
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RuntimeGeneratedInvokerPrototype.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RuntimeGeneratedInvokerPrototype.java
new file mode 100644 (file)
index 0000000..f160748
--- /dev/null
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) 2013 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.controller.sal.binding.codegen.impl;
+
+import java.util.Set;
+
+import org.opendaylight.controller.sal.binding.api.NotificationListener;
+import org.opendaylight.yangtools.yang.binding.Notification;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
+
+final class RuntimeGeneratedInvokerPrototype {
+    private final Set<Class<? extends Notification>> supportedNotifications;
+    private final Class<? extends NotificationListener<?>> protoClass;
+
+    public RuntimeGeneratedInvokerPrototype(final Set<Class<? extends Notification>> supportedNotifications, final Class<? extends NotificationListener<?>> protoClass) {
+        this.supportedNotifications = Preconditions.checkNotNull(supportedNotifications);
+        this.protoClass = Preconditions.checkNotNull(protoClass);
+    }
+
+    public Set<Class<? extends Notification>> getSupportedNotifications() {
+        return supportedNotifications;
+    }
+
+    public Class<? extends NotificationListener<? extends Object>> getProtoClass() {
+        return protoClass;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + supportedNotifications.hashCode();
+        result = prime * result + protoClass.hashCode();
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof RuntimeGeneratedInvokerPrototype)) {
+            return false;
+        }
+        final RuntimeGeneratedInvokerPrototype other = (RuntimeGeneratedInvokerPrototype) obj;
+        if (!protoClass.equals(other.protoClass)) {
+            return false;
+        }
+        return supportedNotifications.equals(other.supportedNotifications);
+    }
+
+    @Override
+    public String toString() {
+        return Objects.toStringHelper(this)
+                .add("protoClass", protoClass)
+                .add("supportedNotifications", supportedNotifications)
+                .toString();
+    }
+}