Bump yangtools to 8.0.1
[mdsal.git] / binding / mdsal-binding-java-api-generator / src / main / java / org / opendaylight / mdsal / binding / java / api / generator / Decimal64RangeGenerator.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. 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.Decimal64;
11 import org.opendaylight.yangtools.yang.common.Uint16;
12 import org.opendaylight.yangtools.yang.common.Uint8;
13
14 final class Decimal64RangeGenerator extends AbstractBigRangeGenerator<Decimal64> {
15     Decimal64RangeGenerator() {
16         super(Decimal64.class);
17     }
18
19     @Override
20     protected String format(final Decimal64 value) {
21         return "org.opendaylight.yangtools.yang.common.Decimal64.valueOf(\"" + value + "\")";
22     }
23
24     @Override
25     @Deprecated
26     protected Decimal64 convert(final Number value) {
27         if (value instanceof Byte || value instanceof Short || value instanceof Integer
28             || value instanceof Uint8 || value instanceof Uint16) {
29             // FIXME: this is not quite right
30             return Decimal64.valueOf(1, value.intValue());
31         } else {
32             // FIXME: this is not quite right
33             return Decimal64.valueOf(1, value.longValue());
34         }
35     }
36 }