2 * Copyright (c) 2019 PANTHEON.tech, s.r.o. 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.concepts;
10 import com.google.common.annotations.Beta;
11 import org.eclipse.jdt.annotation.NonNull;
14 * Utility interface for translation between a external form and an internal form. Implementations should consider
15 * subclassing {@link AbstractIllegalArgumentCodec}.
17 * @param <S> Serialized (external) type
18 * @param <D> Deserialized (internal) type
21 public interface IllegalArgumentCodec<S, D> {
23 * Produce an internal object based on an external object.
25 * @param input Input object
26 * @return Product derived from input
27 * @throws NullPointerException if input is null
28 * @throws IllegalArgumentException when input is not valid
30 @NonNull D deserialize(@NonNull S input);
33 * Produce an external object based on an internal object.
36 * @return An external form object
37 * @throws NullPointerException if input is null
38 * @throws IllegalArgumentException when input is not valid
40 @NonNull S serialize(@NonNull D input);