import javax.management.ObjectName;
import javax.management.openmbean.SimpleType;
-public class DependencyAttribute extends AbstractAttribute implements
- TypedAttribute {
+public class DependencyAttribute extends AbstractDependencyAttribute {
- private final Dependency dependency;
- private final String nullableDescription, nullableDefault;
public DependencyAttribute(DataSchemaNode attrNode,
ServiceInterfaceEntry sie, boolean mandatory,
String nullableDescription) {
- super(attrNode);
- dependency = new Dependency(sie, mandatory);
- this.nullableDescription = nullableDescription;
- nullableDefault = null;
+ super(attrNode, sie, mandatory, nullableDescription);
}
@Override
return Types.typeForClass(ObjectName.class);
}
- public Dependency getDependency() {
- return dependency;
- }
-
- @Override
- public String getNullableDescription() {
- return nullableDescription;
- }
-
- @Override
- public String getNullableDefault() {
- return nullableDefault;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- if (!super.equals(o))
- return false;
-
- DependencyAttribute that = (DependencyAttribute) o;
-
- if (dependency != null ? !dependency.equals(that.dependency)
- : that.dependency != null)
- return false;
- if (nullableDefault != null ? !nullableDefault
- .equals(that.nullableDefault) : that.nullableDefault != null)
- return false;
- if (nullableDescription != null ? !nullableDescription
- .equals(that.nullableDescription)
- : that.nullableDescription != null)
- return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + (dependency != null ? dependency.hashCode() : 0);
- result = 31
- * result
- + (nullableDescription != null ? nullableDescription.hashCode()
- : 0);
- result = 31 * result
- + (nullableDefault != null ? nullableDefault.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "DependencyAttribute{" + getAttributeYangName() + ","
- + "dependency=" + dependency + '}';
- }
-
@Override
public SimpleType<?> getOpenType() {
return SimpleType.OBJECTNAME;
}
- public static class Dependency {
- private final ServiceInterfaceEntry sie;
- private final boolean mandatory;
-
- public Dependency(ServiceInterfaceEntry sie, boolean mandatory) {
- this.sie = sie;
- this.mandatory = mandatory;
- }
-
- public ServiceInterfaceEntry getSie() {
- return sie;
- }
-
- public boolean isMandatory() {
- return mandatory;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
-
- Dependency that = (Dependency) o;
-
- if (mandatory != that.mandatory)
- return false;
- if (!sie.equals(that.sie))
- return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = sie.hashCode();
- result = 31 * result + (mandatory ? 1 : 0);
- return result;
- }
- }
-
}