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.yangtools.yang.data.impl.codec;
10 import com.google.common.base.Optional;
11 import com.google.common.base.Preconditions;
12 import com.google.common.base.Strings;
13 import org.opendaylight.yangtools.yang.data.api.codec.EmptyCodec;
14 import org.opendaylight.yangtools.yang.model.api.type.EmptyTypeDefinition;
16 class EmptyStringCodec extends TypeDefinitionAwareCodec<Void, EmptyTypeDefinition> implements
19 protected EmptyStringCodec(final Optional<EmptyTypeDefinition> typeDef) {
20 super(typeDef, Void.class);
24 public final String serialize(final Void data) {
29 public final Void deserialize(final String stringRepresentation) {
30 Preconditions.checkArgument( Strings.isNullOrEmpty( stringRepresentation ),
31 "The value must be empty" );