2 * Copyright (c) 2024 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.common;
10 import java.io.DataInput;
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.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
19 * An empty alternative to {@link Revision}. This contract is exactly the same as the {@code type string} block from
20 * this fragment from {@code ietf-yang-library}:
23 * type revision-identifier;
31 public final class NotRevision implements RevisionUnion {
33 private static final long serialVersionUID = 1L;
34 private static final NotRevision INSTANCE = new NotRevision();
36 private NotRevision() {
40 public static NotRevision of() {
44 public static NotRevision readFrom(final DataInput in) throws IOException {
45 final var str = in.readUTF();
47 throw new IOException("Unexpected value '" + str + "'");
53 public @Nullable Revision revision() {
58 public String unionString() {
63 public int hashCode() {
68 public boolean equals(final @Nullable Object obj) {
73 public String toString() {
78 Object writeReplace() {
83 private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException {
88 private void readObjectNoData() throws ObjectStreamException {
93 private void writeObject(final ObjectOutputStream stream) throws IOException {