2 * Copyright (c) 2013 Cisco Systems, Inc. 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 java.util.Arrays;
12 // TODO rename to ModifyOperation
15 * See https://tools.ietf.org/html/rfc6241#section-7.2.
17 public enum ModifyAction {
18 MERGE(true), REPLACE(true), CREATE(false), DELETE(false), REMOVE(false), NONE(true, false);
20 public static ModifyAction fromXmlValue(final String xmlNameOfAction) {
21 switch (xmlNameOfAction) {
35 throw new IllegalArgumentException("Unknown operation " + xmlNameOfAction + " available operations "
36 + Arrays.toString(ModifyAction.values()));
40 private final boolean asDefaultPermitted;
41 private final boolean onElementPermitted;
43 ModifyAction(final boolean asDefaultPermitted, final boolean onElementPermitted) {
44 this.asDefaultPermitted = asDefaultPermitted;
45 this.onElementPermitted = onElementPermitted;
48 ModifyAction(final boolean asDefaultPermitted) {
49 this(asDefaultPermitted, true);
52 public boolean isAsDefaultPermitted() {
53 return asDefaultPermitted;
56 public boolean isOnElementPermitted() {
57 return onElementPermitted;