2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the terms of the Eclipse
5 * Public License v1.0 which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.data.impl.codec;
10 import com.google.common.base.Optional;
11 import org.opendaylight.yangtools.yang.data.api.codec.Uint32Codec;
12 import org.opendaylight.yangtools.yang.model.api.type.UnsignedIntegerTypeDefinition;
14 class Uint32StringCodec extends AbstractIntegerStringCodec<Long, UnsignedIntegerTypeDefinition> implements
17 protected Uint32StringCodec(final Optional<UnsignedIntegerTypeDefinition> typeDef) {
18 super(typeDef, extractRange(typeDef.orNull()), Long.class);
22 public final Long deserialize(final String stringRepresentation, final int base) {
23 return Long.valueOf(stringRepresentation, base);
27 public final String serialize(final Long data) {
28 return data == null ? "" : data.toString();
32 protected Long convertValue(final Number value) {
33 return value.longValue();