Finish public DataObjectReference class hierarchy
[yangtools.git] / binding / binding-spec / src / main / java / org / opendaylight / yangtools / binding / impl / DataObjectReferenceImpl.java
1 /*
2  * Copyright (c) 2024 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.binding.impl;
9
10 import com.google.common.collect.ImmutableList;
11 import java.io.IOException;
12 import java.io.ObjectInputStream;
13 import java.io.ObjectOutputStream;
14 import java.io.ObjectStreamException;
15 import org.eclipse.jdt.annotation.NonNull;
16 import org.opendaylight.yangtools.binding.DataObject;
17 import org.opendaylight.yangtools.binding.DataObjectReference;
18 import org.opendaylight.yangtools.binding.DataObjectStep;
19 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
20
21 // FIXME: YANGTOOLS-1577: non-abstract
22 public abstract sealed class DataObjectReferenceImpl<T extends DataObject>
23         extends AbstractDataObjectReference<T, DataObjectStep<?>>
24         permits DataObjectReferenceWithKey {
25     @java.io.Serial
26     private static final long serialVersionUID = 1L;
27
28     public static final @NonNull DataObjectReference<?> ofUnsafeSteps(
29             final ImmutableList<? extends @NonNull DataObjectStep<?>> steps) {
30         // FIXNE: YANGTOOLS-1577: dispatch to this class
31         return InstanceIdentifier.unsafeOf(steps);
32     }
33
34     @java.io.Serial
35     private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException {
36         throwNSE();
37     }
38
39     @java.io.Serial
40     private void readObjectNoData() throws ObjectStreamException {
41         throwNSE();
42     }
43
44     @java.io.Serial
45     private void writeObject(final ObjectOutputStream stream) throws IOException {
46         throwNSE();
47     }
48 }