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) {
39 if (!(o instanceof AbstractAttribute)) {
43 AbstractAttribute that = (AbstractAttribute) o;
45 if (attributeYangName != null ? !attributeYangName
46 .equals(that.attributeYangName)
47 : that.attributeYangName != null) {
55 public int hashCode() {
56 return attributeYangName != null ? attributeYangName.hashCode() : 0;
61 * @return Yang name converted to cammel case, starting with a capital
62 * letter. For details see
63 * {@link org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry#getJavaNamePrefix()}
66 public String getUpperCaseCammelCase() {
67 return upperCaseCammelCase;
70 public String getLowerCaseCammelCase() {
71 return lowerCaseCammelCase;