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.mdsal.binding.model.ri;
10 import java.math.BigDecimal;
11 import org.opendaylight.mdsal.binding.model.api.Type;
12 import org.opendaylight.yangtools.yang.common.Empty;
13 import org.opendaylight.yangtools.yang.common.Uint16;
14 import org.opendaylight.yangtools.yang.common.Uint32;
15 import org.opendaylight.yangtools.yang.common.Uint64;
16 import org.opendaylight.yangtools.yang.common.Uint8;
18 public final class BaseYangTypes {
20 * {@code Type} representation of {@code boolean} YANG type.
22 public static final Type BOOLEAN_TYPE = Types.BOOLEAN;
25 * {@code Type} representation of {@code empty} YANG type.
27 public static final Type EMPTY_TYPE = Types.typeForClass(Empty.class);
29 public static final Type ENUM_TYPE = Types.typeForClass(Enum.class);
32 * {@code Type} representation of {@code int8} YANG type.
34 public static final Type INT8_TYPE = Types.typeForClass(Byte.class);
37 * {@code Type} representation of {@code int16} YANG type.
39 public static final Type INT16_TYPE = Types.typeForClass(Short.class);
42 * {@code Type} representation of {@code int32} YANG type.
44 public static final Type INT32_TYPE = Types.typeForClass(Integer.class);
47 * {@code Type} representation of {@code int64} YANG type.
49 public static final Type INT64_TYPE = Types.typeForClass(Long.class);
52 * {@code Type} representation of {@code string} YANG type.
54 public static final Type STRING_TYPE = Types.STRING;
57 * {@code Type} representation of {@code decimal64} YANG type.
59 public static final Type DECIMAL64_TYPE = Types.typeForClass(BigDecimal.class);
62 * {@code Type} representation of {@code uint8} YANG type.
64 public static final Type UINT8_TYPE = Types.typeForClass(Uint8.class);
67 * {@code Type} representation of {@code uint16} YANG type.
69 public static final Type UINT16_TYPE = Types.typeForClass(Uint16.class);
72 * {@code Type} representation of {@code uint32} YANG type.
74 public static final Type UINT32_TYPE = Types.typeForClass(Uint32.class);
77 * {@code Type} representation of {@code uint64} YANG type.
79 public static final Type UINT64_TYPE = Types.typeForClass(Uint64.class);
82 * {@code Type} representation of {@code binary} YANG type.
84 public static final Type BINARY_TYPE = Types.BYTE_ARRAY;
86 // FIXME: why is this a ParameterizedType (vs. what BindingTypes defines?)
87 public static final Type INSTANCE_IDENTIFIER = Types.parameterizedTypeFor(BindingTypes.INSTANCE_IDENTIFIER);
89 private BaseYangTypes() {
94 * Searches {@code Type} value to which is YANG {@code type} mapped.
96 * @param type string with YANG type name
97 * @return Java {@code Type} representation of {@code type}, or null if the type is not mapped.
98 * @throws NullPointerException if type is null
100 public static Type javaTypeForYangType(final String type) {
107 return DECIMAL64_TYPE;
112 case "instance-identifier":
113 return INSTANCE_IDENTIFIER;