2 * Copyright (c) 2015 Cisco Systems, Inc. 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.Decimal64;
11 import org.opendaylight.yangtools.yang.common.Uint16;
12 import org.opendaylight.yangtools.yang.common.Uint8;
14 final class Decimal64RangeGenerator extends AbstractBigRangeGenerator<Decimal64> {
15 Decimal64RangeGenerator() {
16 super(Decimal64.class);
20 protected String format(final Decimal64 value) {
21 return "org.opendaylight.yangtools.yang.common.Decimal64.valueOf(\"" + value + "\")";
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());
32 // FIXME: this is not quite right
33 return Decimal64.valueOf(1, value.longValue());