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
19 * @deprecated This interface ignores a number of complications when dealing with external forms. For one, it assumes
20 * a serdes operation does not have further context than the input -- and this is seldom the case. The other
21 * failing is that it actively discourages use of checked exceptions to deal with errors at the appropriate
22 * level. Based on these, this interface is deprecated for removal without a replacement. Users are
23 * encouraged to define similar interface fitting their needs.
26 @Deprecated(since = "8.0.0", forRemoval = true)
27 public interface IllegalArgumentCodec<S, D> {
29 * Produce an internal object based on an external object.
31 * @param input Input object
32 * @return Product derived from input
33 * @throws NullPointerException if input is null
34 * @throws IllegalArgumentException when input is not valid
36 @NonNull D deserialize(@NonNull S input);
39 * Produce an external object based on an internal object.
42 * @return An external form object
43 * @throws NullPointerException if input is null
44 * @throws IllegalArgumentException when input is not valid
46 @NonNull S serialize(@NonNull D input);