Binding v2 runtime - adapters - impl - operations invoker
[mdsal.git] / binding2 / mdsal-binding2-spec / src / main / java / org / opendaylight / mdsal / binding / javav2 / spec / base / TreeArgument.java
1 /*
2  * Copyright (c) 2017 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.mdsal.binding.javav2.spec.base;
10
11 import com.google.common.annotations.Beta;
12 import org.opendaylight.mdsal.binding.javav2.spec.structural.TreeChildNode;
13
14 @Beta
15 public abstract class TreeArgument<T> {
16
17     static TreeArgument<TreeRoot> root() {
18         throw new UnsupportedOperationException();
19     }
20
21     static <T extends TreeChildNode<?, ?>> Item<T> singular(Class<T> implementedInterface) {
22         throw new UnsupportedOperationException();
23     }
24
25     TreeArgument() {
26         // Intentionally package-visible & noop
27     }
28
29     public abstract Class<T> getType();
30
31     @Override
32     public int hashCode() {
33         return getType().hashCode();
34     }
35
36     @Override
37     public boolean equals(final Object obj) {
38         if (this == obj) {
39             return true;
40         }
41         if (obj == null) {
42             return false;
43         }
44         if (getClass() != obj.getClass()) {
45             return false;
46         }
47         final TreeArgument<?> other = (TreeArgument<?>) obj;
48         return getType().equals(other.getType());
49     }
50
51 }