Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public API for registering custom value types #461

Open
andrus opened this issue Oct 30, 2020 · 0 comments
Open

Public API for registering custom value types #461

andrus opened this issue Oct 30, 2020 · 0 comments

Comments

@andrus
Copy link
Contributor

andrus commented Oct 30, 2020

Currently to start supporting a new "value type" requires injection of two objects into the corresponding DI maps. E.g. here is how we added "Json" type support recently:

binder.bindMap(Encoder.class).put(Json.class.getName(), JsonEncoder.encoder());
binder.bindMap(JsonValueConverter.class).put(Json.class.getName(), JsonConverter.converter());

It is not obvious (even the naming of the custom objects is rather generic, so I had to wade though source code before I figured out what I need to extend). I think it would be beneficial to expose this API via an AgBuilder method, as this is a rather common operation.

While we are at it, we should probably move all the hardcoded default types to use these DI collections to have a single mechanism for collecting these converters.

@andrus andrus modified the milestones: 3.7, 4.1 Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant