final Optional<Encoding> maybeEncodingKey = fromNullable(field.getAnnotation(Enumerated.class)).transform(keyEncoding);
final Optional<Encoding> maybeEncodingValue = fromNullable(field.getAnnotation(Enumerated.class)).transform(valueEncoding);
final Pair<Class<Object>, Class<Object>> sourceTargetTypes = TypeParser.determineMapGenericTypes(field);
final Codec keyCodec = createSimpleCodec(context, sourceTargetTypes.left, maybeEncodingKey);
final Codec valueCodec = createSimpleCodec(context, sourceTargetTypes.right, maybeEncodingValue);
return MapCodecBuilder.fromKeyType(keyCodec.sourceType())
.toKeyType(keyCodec.targetType())
.withKeyCodec(keyCodec)
.fromValueType(valueCodec.sourceType())
.toValueType(valueCodec.targetType())
.withValueCodec(valueCodec);
}
}