You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2019/10/06 18:30:00 UTC

[jira] [Commented] (LOG4J2-860) Unify plugin builders and plugin factories

    [ https://issues.apache.org/jira/browse/LOG4J2-860?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16945422#comment-16945422 ] 

ASF subversion and git services commented on LOG4J2-860:
--------------------------------------------------------

Commit a1c3c7829e2fe3edea415a25121e31fb0afc0f1a in logging-log4j2's branch refs/heads/master from Matt Sicker
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=a1c3c78 ]

Extract binder, injector, and name provider APIs

This refactors some of the strategies used for configuring and
instantiating plugins. The previously named
ConfigurationInjectionBuilder classes have been renamed to be
ConfigurationInjector as they are no longer builder classes.
This API has been simplified to find an appropriate injector
given an AnnotatedElement which can automatically set both
the AnnotatedElement and the Annotation. Conversion types have
been weakened to use java.lang.reflect.Type rather than Class.
This introduces a new plugin SPI named OptionBinder for
abstracting the binding strategies previously used in the
massive PluginBuilder class as desired by LOG4J2-860. This SPI
is extended to include support for method-based configuration
injection into plugin builder classes as specified in
LOG4J2-2700. This introduces another plugin SPI for specifying
the name of an annotated element rather than relying on Java
reflection to calculate the name. This SPI also fixes
LOG4J2-2693.

Signed-off-by: Matt Sicker <bo...@gmail.com>


> Unify plugin builders and plugin factories
> ------------------------------------------
>
>                 Key: LOG4J2-860
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-860
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Plugins
>    Affects Versions: 2.2
>            Reporter: Matt Sicker
>            Assignee: Matt Sicker
>            Priority: Major
>
> Before we can even settle on a preferred way to create plugins reflectively, it would be nice to combine the PluginAttribute and PluginBuilderAttribute annotations. In fact, allowing for flexibility in dependency injection for creating plugins would be better than strictly allowing factory methods or builder classes only. For instance, setter methods could be annotated for injection which allows for further customization.
> Since the ability to reflect on a parameter to get its name wasn't added until Java 1.8 (and alternatives require using bytecode libraries like asm), it would be nice to add some sort of plugin validation to the annotation processor to prevent users from forgetting to specify an attribute name when attached to a parameter instead of a field.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)