2 * Copyright (c) 2020 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.rfc6643.model.api;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.Beta;
13 import com.google.common.collect.ImmutableMap;
14 import com.google.common.collect.Maps;
15 import java.util.Arrays;
16 import org.eclipse.jdt.annotation.NonNull;
17 import org.eclipse.jdt.annotation.Nullable;
20 * Maximum allowed access, as defined by
21 * <a href="https://tools.ietf.org/html/rfc2578#section-7.3">RFC2578 Section 7.3</a>.
24 public enum MaxAccess {
26 * Indicates the annotated object is an auxiliary object, as per
27 * <a href="https://tools.ietf.org/html/rfc2578#section-7.7">RFC2578 Section 7.7</a>.
29 NOT_ACCESSIBLE("not-accessible"),
31 * Indicates the annotated object is accessible only for notifications.
33 ACCESSIBLE_FOR_NOTIFY("accessible-for-notify"),
35 * Indicates that {@code read} access makes 'protocol sense', but {@code write} and {@code create} do not.
37 READ_ONLY("read-only"),
39 * Indicates that {@code read} and {@code write} access make 'protocol sense', but {@code create} does not.
41 READ_WRITE("read-write"),
43 * Indicates that {@code read}, {@code write} and {@code create} access make 'protocol sense'.
45 READ_CREATE("read-create");
47 private static final ImmutableMap<String, MaxAccess> VALUES =
48 Maps.uniqueIndex(Arrays.asList(MaxAccess.values()), MaxAccess::stringLiteral);
50 private @NonNull String str;
52 MaxAccess(final @NonNull String str) {
56 public @NonNull String stringLiteral() {
60 public static @Nullable MaxAccess forStringLiteral(final @NonNull String str) {
61 return VALUES.get(requireNonNull(str));