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
9 package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes;
11 import org.opendaylight.controller.config.yangjmxgenerator.attribute.*;
13 public abstract class AttributeIfcSwitchStatement<T> {
15 public T switchAttribute(AttributeIfc attributeIfc) {
17 if (attributeIfc instanceof JavaAttribute) {
18 return caseJavaAttribute((JavaAttribute) attributeIfc);
19 } else if (attributeIfc instanceof DependencyAttribute) {
20 return caseDependencyAttribute((DependencyAttribute) attributeIfc);
21 } else if (attributeIfc instanceof ListAttribute) {
22 return caseListAttribute((ListAttribute) attributeIfc);
23 } else if (attributeIfc instanceof TOAttribute) {
24 return caseTOAttribute((TOAttribute) attributeIfc);
27 throw new IllegalArgumentException("Unknown attribute type " + attributeIfc.getClass() + ", " + attributeIfc);
30 protected abstract T caseJavaAttribute(JavaAttribute attributeIfc);
32 protected abstract T caseDependencyAttribute(DependencyAttribute attributeIfc);
34 protected abstract T caseTOAttribute(TOAttribute attributeIfc);
36 protected abstract T caseListAttribute(ListAttribute attributeIfc);