Fix a typo in UnionTemplate
[mdsal.git] / binding / mdsal-binding-java-api-generator / src / main / java / org / opendaylight / mdsal / binding / java / api / generator / Uint32RangeGenerator.java
1 /*
2  * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mdsal.binding.java.api.generator;
9
10 import org.opendaylight.yangtools.yang.common.Uint16;
11 import org.opendaylight.yangtools.yang.common.Uint32;
12 import org.opendaylight.yangtools.yang.common.Uint8;
13
14 final class Uint32RangeGenerator extends AbstractUnsignedRangeGenerator<Uint32> {
15     Uint32RangeGenerator() {
16         super(Uint32.class, long.class.getName(), Uint32.ZERO, Uint32.MAX_VALUE);
17     }
18
19     @Override
20     @Deprecated
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());
25         }
26         return Uint32.valueOf(value.toString());
27     }
28
29     @Override
30     protected String format(final Uint32 value) {
31         return value.toCanonicalString() + 'L';
32     }
33 }