2 * Copyright (c) 2019 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.java.api.generator;
10 import org.opendaylight.yangtools.yang.common.Uint16;
11 import org.opendaylight.yangtools.yang.common.Uint8;
13 final class Uint16RangeGenerator extends AbstractUnsignedRangeGenerator<Uint16> {
14 Uint16RangeGenerator() {
15 super(Uint16.class, int.class.getName(), Uint16.ZERO, Uint16.MAX_VALUE);
20 protected Uint16 convert(final Number value) {
21 if (value instanceof Byte || value instanceof Short || value instanceof Integer || value instanceof Uint8) {
22 return Uint16.valueOf(value.intValue());
24 return Uint16.valueOf(value.toString());
28 protected String format(final Uint16 value) {
29 return value.toCanonicalString();