Expose DataObjectReference.lastStep()
[yangtools.git] / binding / binding-spec / src / main / java / org / opendaylight / yangtools / binding / impl / DataObjectIdentifierWithKey.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 java.io.IOException;
11 import java.io.ObjectInputStream;
12 import java.io.ObjectOutputStream;
13 import java.io.ObjectStreamException;
14 import org.opendaylight.yangtools.binding.DataObject;
15 import org.opendaylight.yangtools.binding.DataObjectIdentifier.WithKey;
16 import org.opendaylight.yangtools.binding.Key;
17 import org.opendaylight.yangtools.binding.KeyAware;
18 import org.opendaylight.yangtools.binding.KeyStep;
19
20 // FIXME: YANGTOOLS-1577: final
21 public abstract non-sealed class DataObjectIdentifierWithKey<T extends KeyAware<K> & DataObject, K extends Key<T>>
22         extends DataObjectIdentifierImpl<T> implements WithKey<T, K> {
23     @java.io.Serial
24     private static final long serialVersionUID = 1L;
25
26     @Override
27     public final KeyStep<K, T> lastStep() {
28         return getLast(steps());
29     }
30
31     @java.io.Serial
32     private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException {
33         throwNSE();
34     }
35
36     @java.io.Serial
37     private void readObjectNoData() throws ObjectStreamException {
38         throwNSE();
39     }
40
41     @java.io.Serial
42     private void writeObject(final ObjectOutputStream stream) throws IOException {
43         throwNSE();
44     }
45 }