ppkarwasz commented on issue #3775:
URL:
https://github.com/apache/logging-log4j2/issues/3775#issuecomment-3092156782
Hi @yybmion,
> ```java
> public static String[] getSupportedConfigurationExtensions() {
> final List<String> extensions = new ArrayList<>();
> for (final ConfigurationFactory factory : getFactories()) {
> if (factory.isActive()) {
> final String[] types = factory.getSupportedTypes();
> if (types != null) {
> for (final String type : types) {
> if (!"*".equals(type) && !extensions.contains(type)) {
> extensions.add(type);
> }
> }
> }
> }
> }
> return extensions.toArray(new String[0]);
> }
> ```
The plan looks solid! :+1: Just a few small suggestions before you move
forward:
- Consider a shorter name like `getSupportedExtensions()` or
`getActiveFileExtensions()`.
- Instead of a static method, it might make more sense as an **instance
method** on `ConfigurationFactory`, so each factory can report the extensions
it currently supports. The default factory (`ConfigurationFactory.Factory`)
could then aggregate results from all the detected factories.
- Returning a `List<String>` instead of an array might simplify aggregation
and deduplication logic.
Looking forward to seeing how this evolves!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]