private void setupKeys() {
//        for (Field f : keyRegistry.getDeclaredFields()) {
//            FieldId ann = f.getAnnotation(FieldId.class);
//            if (ann != null) {
//                Object okey;
//                try {
//                    okey = f.get(TKey.class);
//                } catch (IllegalAccessException | IllegalArgumentException ex) {
//                    okey = null;
//                }
//                if (okey == null || !(okey instanceof TKey)) {
//                    continue;
//                }
//                
//                TKey key = (TKey) okey;
//                
//                elementNames.put(key.getName(), key);
//                if (!baseTypeSerializers.containsKey(key.getType())) {
//                    serializers.put(key.getType(), new AnnotationBasedJsonSerializer(key.getType()));
//                    deserializers.put(key.getType(), new AnnotationBasedJsonDeserializer(key.getType()));
//                }
//            }
//        }

        Set<TKey<?, ?>> keys = registry.getAvailableKeys();
        for (TKey<?, ?> key : keys) {
            elementNames.put(key.getName(), key);
            if (!baseTypeSerializers.containsKey(key.getType())) {
                if (Enum.class.isAssignableFrom(key.getType())) {
                    baseTypeSerializers.put(key.getType(), new EnumSerializer((Class<? extends Enum>) key.getType()));
                    baseTypeDeserializers.put(key.getType(), new EnumDeserializer((Class<? extends Enum>) key.getType()));
                } else {
                    serializers.put(key.getType(), new AnnotationBasedJsonSerializer(key.getType()));
                    deserializers.put(key.getType(), new AnnotationBasedJsonDeserializer(key.getType()));
                }
            }
        }
    }