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) {
45 if (o == null || getClass() != o.getClass())
50 AbstractDependencyAttribute that = (AbstractDependencyAttribute) o;
52 if (dependency != null ? !dependency.equals(that.dependency)
53 : that.dependency != null)
55 if (nullableDefault != null ? !nullableDefault
56 .equals(that.nullableDefault) : that.nullableDefault != null)
58 if (nullableDescription != null ? !nullableDescription
59 .equals(that.nullableDescription)
60 : that.nullableDescription != null)
67 public int hashCode() {
68 int result = super.hashCode();
69 result = 31 * result + (dependency != null ? dependency.hashCode() : 0);
72 + (nullableDescription != null ? nullableDescription.hashCode()
75 + (nullableDefault != null ? nullableDefault.hashCode() : 0);
80 public String toString() {
81 return getClass().getName() + "{" + getAttributeYangName() + ","
82 + "dependency=" + dependency + '}';