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.Uint32;
12 import org.opendaylight.yangtools.yang.common.Uint8;
14 final class Uint32RangeGenerator extends AbstractUnsignedRangeGenerator<Uint32> {
15 Uint32RangeGenerator() {
16 super(Uint32.class, long.class.getName(), Uint32.ZERO, Uint32.MAX_VALUE);
21 protected Uint32 convert(final Number value) {
22 if (value instanceof Byte || value instanceof Short || value instanceof Integer || value instanceof Long
23 || value instanceof Uint8 || value instanceof Uint16) {
24 return Uint32.valueOf(value.longValue());
26 return Uint32.valueOf(value.toString());
30 protected String format(final Uint32 value) {
31 return value.toCanonicalString() + 'L';