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.yang.data.api;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.collect.ImmutableSet;
13 import java.io.Externalizable;
14 import java.io.IOException;
15 import java.io.ObjectInput;
16 import java.io.ObjectOutput;
17 import java.io.Serial;
18 import org.opendaylight.yangtools.yang.common.QName;
19 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
22 * Externalizable proxy for {@link AugmentationIdentifier}.
24 final class AIv1 implements Externalizable {
26 private static final long serialVersionUID = 1L;
28 private AugmentationIdentifier ai;
30 @SuppressWarnings("checkstyle:redundantModifier")
35 AIv1(final AugmentationIdentifier ai) {
36 this.ai = requireNonNull(ai);
40 public void writeExternal(final ObjectOutput out) throws IOException {
41 out.writeInt(ai.getPossibleChildNames().size());
42 for (QName qname : ai.getPossibleChildNames()) {
48 public void readExternal(final ObjectInput in) throws IOException {
49 final int count = in.readInt();
50 final QName[] qnames = new QName[count];
51 for (int i = 0; i < count; ++i) {
52 qnames[i] = QName.readFrom(in);
54 ai = new AugmentationIdentifier(ImmutableSet.copyOf(qnames));
58 private Object readResolve() {