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;
10 import org.opendaylight.yangtools.sal.binding.generator.spi.TypeProvider;
11 import org.opendaylight.yangtools.sal.binding.model.api.Type;
12 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
13 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
15 public class TypeProviderWrapper {
16 private final TypeProvider typeProvider;
18 public TypeProviderWrapper(TypeProvider typeProvider) {
19 this.typeProvider = typeProvider;
22 public Type getType(LeafSchemaNode leaf) {
25 javaType = typeProvider.javaTypeForSchemaDefinitionType(
26 leaf.getType(), leaf);
28 throw new IllegalArgumentException("Unknown type received for "
30 } catch (IllegalArgumentException e) {
31 throw new IllegalArgumentException("Error while resolving type of "
37 // there is no getType in common interface
38 public Type getType(LeafListSchemaNode leaf) {
41 javaType = typeProvider.javaTypeForSchemaDefinitionType(
42 leaf.getType(), leaf);
44 throw new IllegalArgumentException(
45 "Unknown type received for " + leaf.toString());
46 } catch (IllegalArgumentException e) {
47 throw new IllegalArgumentException("Error while resolving type of "