2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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.yang.types;
10 import org.eclipse.jdt.annotation.NonNull;
11 import org.opendaylight.mdsal.binding.model.api.Restrictions;
12 import org.opendaylight.mdsal.binding.model.api.Type;
13 import org.opendaylight.mdsal.binding.model.ri.BaseYangTypes;
14 import org.opendaylight.mdsal.binding.model.ri.Types;
15 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
18 @Deprecated(forRemoval = true)
19 final class BaseYangTypesProvider implements TypeProvider {
20 static final @NonNull BaseYangTypesProvider INSTANCE = new BaseYangTypesProvider();
22 private BaseYangTypesProvider() {
27 * Searches <code>Type</code> value to which is YANG <code>type</code>
31 * type definition representation of YANG type
32 * @return java <code>Type</code> representation of <code>type</code>.
33 * If <code>type</code> isn't found then <code>null</code> is
37 public Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type, final SchemaNode parentNode,
38 final boolean lenientRelativeLeafrefs) {
39 return type == null ? null : BaseYangTypes.javaTypeForYangType(type.getQName().getLocalName());
43 public Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type, final SchemaNode parentNode,
44 final Restrictions restrictions, final boolean lenientRelativeLeafrefs) {
45 final String typeName = type.getQName().getLocalName();
46 final Type mapped = BaseYangTypes.javaTypeForYangType(typeName);
47 return mapped == null || restrictions == null ? mapped : Types.restrictedType(mapped, restrictions);