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.TypeProviderWrapper;
11 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
13 public abstract class AbstractAttribute implements AttributeIfc {
14 private final String attributeYangName, upperCaseCammelCase,
16 protected final DataSchemaNode node;
18 private static String getLocalName(DataSchemaNode attrNode) {
19 return attrNode.getQName().getLocalName();
22 AbstractAttribute(DataSchemaNode attrNode) {
23 this.attributeYangName = getLocalName(attrNode);
25 this.upperCaseCammelCase = TypeProviderWrapper.findJavaNamePrefix(node);
26 this.lowerCaseCammelCase = TypeProviderWrapper.findJavaParameter(node);
30 public String getAttributeYangName() {
31 return attributeYangName;
35 public boolean equals(Object o) {
38 if (!(o instanceof AbstractAttribute))
41 AbstractAttribute that = (AbstractAttribute) o;
43 if (attributeYangName != null ? !attributeYangName
44 .equals(that.attributeYangName)
45 : that.attributeYangName != null)
52 public int hashCode() {
53 return attributeYangName != null ? attributeYangName.hashCode() : 0;
58 * @return Yang name converted to cammel case, starting with a capital
59 * letter. For details see
60 * {@link ModuleMXBeanEntry#findJavaNamePrefix(org.opendaylight.yangtools.yang.model.api.SchemaNode)}
63 public String getUpperCaseCammelCase() {
64 return upperCaseCammelCase;
67 public String getLowerCaseCammelCase() {
68 return lowerCaseCammelCase;