public TinyTypesKeyDeserializer(Class<?> type) { if (type == null || !MetaTinyTypes.isTinyType(type)) { throw new IllegalArgumentException( String.format("not a tinytype: %s", type == null ? "null" : type.getCanonicalName())); } this.type = type; }
@Override public KeyDeserializer findKeyDeserializer( JavaType type, DeserializationConfig config, BeanDescription beanDesc) throws JsonMappingException { final Class<?> candidateTT = type.getRawClass(); if (MetaTinyTypes.isTinyType(candidateTT)) { return new TinyTypesKeyDeserializer(candidateTT); } return null; }
@Override public Object deserializeKey(String key, DeserializationContext ctxt) throws IOException, JsonProcessingException { return MetaTinyTypes.metaFor(type).fromString(type, key); }