/*
 * This file is part of Sponge, licensed under the MIT License (MIT).
 *
 * Copyright (c) SpongePowered <https://www.spongepowered.org>
 * Copyright (c) contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.spongepowered.common.data.key;

import static org.spongepowered.api.data.DataQuery.of;

import com.google.common.collect.MapMaker;
import org.spongepowered.api.data.DataQuery;
import org.spongepowered.api.data.key.Key;
import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.data.type.Career;
import org.spongepowered.api.data.value.BaseValue;
import org.spongepowered.api.data.value.mutable.MutableBoundedValue;
import org.spongepowered.api.data.value.mutable.Value;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.util.Axis;
import org.spongepowered.common.data.key.SpongeKey;
import org.spongepowered.common.registry.RegistryHelper;

import java.awt.Color;
import java.util.Map;

@SuppressWarnings({"unchecked"})
public class KeyRegistry {

    private static final Map<String, Key<?>> keyMap = new MapMaker().concurrencyLevel(4).makeMap();

    public static void registerKeys() {
        keyMap.put("AXIS", makeKey(Axis.class, Value.class, of("Axis")));
        keyMap.put("COLOR", makeKey(Color.class, Value.class, of("Color")));
        keyMap.put("HEALTH", makeKey(Double.class, MutableBoundedValue.class, of("Health")));
        keyMap.put("MAX_HEALTH", makeKey(Double.class, MutableBoundedValue.class, of("MaxHealth")));
        keyMap.put("SHOWS_DISPLAY_NAME", makeKey(Boolean.class, Value.class, of("ShowDisplayName")));
        keyMap.put("DISPLAY_NAME", makeKey(Text.class, Value.class, of("DisplayName")));
        keyMap.put("CAREER", makeKey(Career.class, Value.class, of("Career")));
        RegistryHelper.mapFields(Keys.class, keyMap);
    }

    private static <E, V extends BaseValue<E>> Key<V> makeKey(final Class<E> elementClass, final Class<V> valueClass,
            final DataQuery query) {
        return new SpongeKey<E, V>(elementClass, valueClass, query);
    }

}

@@ -2200,12 +2200,12 @@
 ut(%22
-AXIS
+axis
 %22, m
@@ -2274,13 +2274,13 @@
 ut(%22
-COLOR
+color
 %22, m
@@ -2347,22 +2347,22 @@
 ap.put(%22
-HEALTH
+health
 %22, makeK
@@ -2445,18 +2445,18 @@
 ut(%22
-MAX_HEALTH
+max_health
 %22, m
@@ -2546,26 +2546,26 @@
 ut(%22
-SHOWS_DISPLAY_NAME
+shows_display_name
 %22, m
@@ -2648,20 +2648,20 @@
 ut(%22
-DISPLAY_NAME
+display_name
 %22, m
@@ -2737,14 +2737,14 @@
 ut(%22
-CAREER
+career
 %22, m

Update KeyRegistry for RegistryHelper changes