/*
 * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

package org.opendaylight.yangtools.yang.model.api.type;

import static java.util.Objects.requireNonNull;

import com.google.common.collect.Maps;
import java.util.Arrays;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nonnull;

/**
 * Enum describing the effect of a YANG modifier statement.
 *
 * <p>
 * As of YANG 1.1 (RFC7950) there is only one modifier value available and that
 * is "invert-match". If there are more possible values added in the future,
 * this enum can be extended with more enum constants.
 */
public enum ModifierKind {
    INVERT_MATCH("invert-match");

    private static final Map<String, ModifierKind> MODIFIER_KIND_MAP = Maps.uniqueIndex(
        Arrays.asList(ModifierKind.values()), ModifierKind::getKeyword);

    private final String keyword;

    ModifierKind(final String keyword) {
        this.keyword = requireNonNull(keyword);
    }

    /**
     * YANG keyword of this modifier.
     *
     * @return String that corresponds to the YANG keyword.
     */
    public @Nonnull String getKeyword() {
        return keyword;
    }

    /**
     * Returns ModifierKind based on supplied Yang keyword.
     *
     * @param keyword
     *            Yang keyword in string form
     * @return ModifierKind based on supplied YANG keyword
     * @throws NullPointerException if keyword is null
     */
    public static Optional<ModifierKind> parse(final String keyword) {
        return Optional.ofNullable(MODIFIER_KIND_MAP.get(requireNonNull(keyword)));
    }
}

@@ -301,17 +301,16 @@
 tml%0A */%0A
-%0A
 package 
@@ -531,13 +531,23 @@
 ort 
-javax
+org.eclipse.jdt
 .ann
@@ -557,17 +557,17 @@
 tion.Non
-n
+N
 ull;%0A%0A/*
@@ -717,19 +717,16 @@
 and that
-%0A *
  is %22inv
@@ -754,16 +754,19 @@
 are more
+%0A *
  possibl
@@ -794,19 +794,16 @@
  future,
-%0A *
  this en
@@ -1090,24 +1090,33 @@
 ivate final 
+@NonNull 
 String keywo
@@ -1139,24 +1139,33 @@
 rKind(final 
+@NonNull 
 String keywo
@@ -1361,17 +1361,17 @@
 lic @Non
-n
+N
 ull Stri
@@ -1474,19 +1474,19 @@
 pplied Y
-ang
+ANG
  keyword
@@ -1519,31 +1519,13 @@
 word
-%0A     *            Yang
+ YANG
  key
@@ -1719,16 +1719,25 @@
 e(final 
+@NonNull 
 String k

Migrate ModifierKind to JDT annotations