2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.config.yangjmxgenerator.attribute;
10 import org.opendaylight.controller.config.yangjmxgenerator.ServiceInterfaceEntry;
11 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
13 public abstract class AbstractDependencyAttribute extends AbstractAttribute implements TypedAttribute {
15 protected final Dependency dependency;
16 protected final String nullableDescription, nullableDefault;
18 public AbstractDependencyAttribute(DataSchemaNode attrNode,
19 ServiceInterfaceEntry sie, boolean mandatory,
20 String nullableDescription) {
22 dependency = new Dependency(sie, mandatory);
23 this.nullableDescription = nullableDescription;
24 nullableDefault = null;
27 public Dependency getDependency() {
32 public String getNullableDescription() {
33 return nullableDescription;
37 public String getNullableDefault() {
38 return nullableDefault;
42 public boolean equals(Object o) {
46 if (o == null || getClass() != o.getClass()) {
49 if (!super.equals(o)) {
53 AbstractDependencyAttribute that = (AbstractDependencyAttribute) o;
55 if (dependency != null ? !dependency.equals(that.dependency)
56 : that.dependency != null) {
59 if (nullableDefault != null ? !nullableDefault
60 .equals(that.nullableDefault) : that.nullableDefault != null) {
63 if (nullableDescription != null ? !nullableDescription
64 .equals(that.nullableDescription)
65 : that.nullableDescription != null) {
73 public int hashCode() {
74 int result = super.hashCode();
75 result = 31 * result + (dependency != null ? dependency.hashCode() : 0);
78 + (nullableDescription != null ? nullableDescription.hashCode()
81 + (nullableDefault != null ? nullableDefault.hashCode() : 0);
86 public String toString() {
87 return getClass().getName() + "{" + getAttributeYangName() + ","
88 + "dependency=" + dependency + '}';