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

Support BitSet look up out of box #570

Closed
1 of 4 tasks
Emily-Jiang opened this issue May 28, 2020 · 5 comments
Closed
1 of 4 tasks

Support BitSet look up out of box #570

Emily-Jiang opened this issue May 28, 2020 · 5 comments
Labels
use case 💡 An issue which illustrates a desired use case for the specification

Comments

@Emily-Jiang
Copy link
Member

As a:

  • Application user/user of the configuration itself
  • API user (application developer)
  • SPI user (container or runtime developer)
  • Specification implementer

...I need to be able to:

directly inject or programmatically look BitSet in my java class without providing a converter myself.

...which enables me to:

Specify a bitset in a configsource and then I can look up from my java class
bits=10001

@Inject @ConfigProperty(name="bits") BitSet bits;

@Emily-Jiang Emily-Jiang added the use case 💡 An issue which illustrates a desired use case for the specification label May 28, 2020
@Emily-Jiang Emily-Jiang changed the title Support BitSet Support BitSet look up out of box May 28, 2020
@radcortez
Copy link
Contributor

Isn't this type too specific for a built in converter?

@Emily-Jiang
Copy link
Member Author

Emily-Jiang commented May 28, 2020

Isn't this type too specific for a built in converter?

What do you mean? I think it is useful to add it to the list of built in converter.

@tomas-langer
Copy link

Why BitSet specifically? There are a lot of classes that could be supported by built-in converters such as:

  • BigDecimal
  • BigInteger
  • all the java.time classes
  • Path
  • Charset
  • URI
  • URL
  • Pattern
  • UUID
  • all old time classes, such as Date, Calendar, TimeZone....

And probably a lot others. I would argue there are some much more widely used than BitSet

@Emily-Jiang
Copy link
Member Author

Emily-Jiang commented Sep 23, 2020

@tomas-langer most of the converters you mentioned are already supported and they are under automatic converter category. See the category details here. In more details,

If no built-in nor custom Converter exists for a requested Type T, an implicit Converter is automatically provided if the following conditions are met:

The target type T has a public static T of(String) method, or

The target type T has a public static T valueOf(String) method, or

The target type T has a public static T parse(CharSequence) method : all of java.time classes 

The target type T has a public Constructor with a String parameter : BigDecimal, BigInteger, URI, URL, Path

This leaves UUID, Charset, and Pattern.

For the old time classes, I think the java.time is more preferred and they become legacy. I suggest not to do anything for them. I will open another issue to support UUID, Charset and Pattern as built-in converters.

In the meanwhile, I'm going to close this issue of adding Bitset as built-in converter since not many people are keen with this.

@Emily-Jiang
Copy link
Member Author

See #604 @tomas-langer please comment if you think more converters are to be added. I believe I have address your comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
use case 💡 An issue which illustrates a desired use case for the specification
Projects
None yet
Development

No branches or pull requests

3 participants