Discussion:
svn commit: r1599839 - /logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
Ralph Goers
2014-06-04 00:05:49 UTC
Permalink
Why would you add a class attribute when the annotation is annotating the class and you can get it from that?

Ralph
Author: mattsicker
Date: Tue Jun 3 23:50:29 2014
New Revision: 1599839
URL: http://svn.apache.org/r1599839
Revert that idea about the default name.
- Going to add an optional Class attribute instead.
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java?rev=1599839&r1=1599838&r2=1599839&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java Tue Jun 3 23:50:29 2014
@@ -38,10 +38,9 @@ public @interface Plugin {
String EMPTY = Strings.EMPTY;
/**
- * Name of the plugin. If no name is specified, defaults to the simple class name of the annotated element.
- * Note that this name is case-insensitive.
+ * Name of the plugin. Note that this name is case-insensitive.
*/
- String name() default EMPTY;
+ String name();
/**
* Category to place the plugin under. Category names are case-sensitive.
Matt Sicker
2014-06-04 00:07:15 UTC
Permalink
I changed my mind on that and am adding a @ConvertType annotation that will
be scanned at runtime. No changes to @Plugin or the annotation processor
this way, too.
Post by Ralph Goers
Why would you add a class attribute when the annotation is annotating the
class and you can get it from that?
Ralph
Author: mattsicker
Date: Tue Jun 3 23:50:29 2014
New Revision: 1599839
URL: http://svn.apache.org/r1599839
Revert that idea about the default name.
- Going to add an optional Class attribute instead.
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java?rev=1599839&r1=1599838&r2=1599839&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
Tue Jun 3 23:50:29 2014
@@ -38,10 +38,9 @@ public @interface Plugin {
String EMPTY = Strings.EMPTY;
/**
- * Name of the plugin. If no name is specified, defaults to the
simple class name of the annotated element.
- * Note that this name is case-insensitive.
+ * Name of the plugin. Note that this name is case-insensitive.
*/
- String name() default EMPTY;
+ String name();
/**
* Category to place the plugin under. Category names are
case-sensitive.
---------------------------------------------------------------------
--
Matt Sicker <***@gmail.com>
Ralph Goers
2014-06-04 00:18:01 UTC
Permalink
Similar to why I created @ConverterKeys for pattern converters I guess? That sounds correct.

Ralph
Post by Ralph Goers
Why would you add a class attribute when the annotation is annotating the class and you can get it from that?
Ralph
Author: mattsicker
Date: Tue Jun 3 23:50:29 2014
New Revision: 1599839
URL: http://svn.apache.org/r1599839
Revert that idea about the default name.
- Going to add an optional Class attribute instead.
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java?rev=1599839&r1=1599838&r2=1599839&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java Tue Jun 3 23:50:29 2014
@@ -38,10 +38,9 @@ public @interface Plugin {
String EMPTY = Strings.EMPTY;
/**
- * Name of the plugin. If no name is specified, defaults to the simple class name of the annotated element.
- * Note that this name is case-insensitive.
+ * Name of the plugin. Note that this name is case-insensitive.
*/
- String name() default EMPTY;
+ String name();
/**
* Category to place the plugin under. Category names are case-sensitive.
---------------------------------------------------------------------
--
Matt Sicker
2014-06-04 03:31:31 UTC
Permalink
Indeed.
Post by Ralph Goers
That sounds correct.
Ralph
processor this way, too.
Post by Ralph Goers
Why would you add a class attribute when the annotation is annotating the
class and you can get it from that?
Ralph
Author: mattsicker
Date: Tue Jun 3 23:50:29 2014
New Revision: 1599839
URL: http://svn.apache.org/r1599839
Revert that idea about the default name.
- Going to add an optional Class attribute instead.
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java?rev=1599839&r1=1599838&r2=1599839&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
Tue Jun 3 23:50:29 2014
@@ -38,10 +38,9 @@ public @interface Plugin {
String EMPTY = Strings.EMPTY;
/**
- * Name of the plugin. If no name is specified, defaults to the
simple class name of the annotated element.
- * Note that this name is case-insensitive.
+ * Name of the plugin. Note that this name is case-insensitive.
*/
- String name() default EMPTY;
+ String name();
/**
* Category to place the plugin under. Category names are
case-sensitive.
---------------------------------------------------------------------
--
--
Matt Sicker <***@gmail.com>
Gary Gregory
2014-06-04 04:42:06 UTC
Permalink
At runtime just for the core or the whole CP? Performance? 

Gary

<div>-------- Original message --------</div><div>From: Matt Sicker <***@gmail.com> </div><div>Date:06/03/2014 23:31 (GMT-05:00) </div><div>To: Log4J Developers List <log4j-***@logging.apache.org> </div><div>Subject: Re: svn commit: r1599839 - /logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java </div><div>
</div>Indeed.


On 3 June 2014 19:18, Ralph Goers <***@dslextreme.com> wrote:
Similar to why I created @ConverterKeys for pattern converters I guess? That sounds correct.

Ralph

On Jun 3, 2014, at 5:07 PM, Matt Sicker <***@gmail.com> wrote:

I changed my mind on that and am adding a @ConvertType annotation that will be scanned at runtime. No changes to @Plugin or the annotation processor this way, too.


On 3 June 2014 19:05, Ralph Goers <***@dslextreme.com> wrote:
Why would you add a class attribute when the annotation is annotating the class and you can get it from that?

Ralph
Author: mattsicker
Date: Tue Jun 3 23:50:29 2014
New Revision: 1599839
URL: http://svn.apache.org/r1599839
Revert that idea about the default name.
- Going to add an optional Class attribute instead.
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java?rev=1599839&r1=1599838&r2=1599839&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java Tue Jun 3 23:50:29 2014
@@ -38,10 +38,9 @@ public @interface Plugin {
String EMPTY = Strings.EMPTY;
/**
- * Name of the plugin. If no name is specified, defaults to the simple class name of the annotated element.
- * Note that this name is case-insensitive.
+ * Name of the plugin. Note that this name is case-insensitive.
*/
- String name() default EMPTY;
+ String name();
/**
* Category to place the plugin under. Category names are case-sensitive.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-***@logging.apache.org
For additional commands, e-mail: log4j-dev-***@logging.apache.org
--
Matt Sicker <***@gmail.com>
--
Matt Sicker <***@gmail.com>
Ralph Goers
2014-06-04 04:52:36 UTC
Permalink
If I understand what Matt is doing the new converters will be annotated with the data type that they support, similar to how the pattern converters are annotated with the pattern tokens used to identify them.

Ralph
Post by Gary Gregory
At runtime just for the core or the whole CP? Performance?
Gary
-------- Original message --------
From: Matt Sicker
Date:06/03/2014 23:31 (GMT-05:00)
To: Log4J Developers List
Subject: Re: svn commit: r1599839 - /logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
Indeed.
Ralph
Post by Ralph Goers
Why would you add a class attribute when the annotation is annotating the class and you can get it from that?
Ralph
Author: mattsicker
Date: Tue Jun 3 23:50:29 2014
New Revision: 1599839
URL: http://svn.apache.org/r1599839
Revert that idea about the default name.
- Going to add an optional Class attribute instead.
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java?rev=1599839&r1=1599838&r2=1599839&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java Tue Jun 3 23:50:29 2014
@@ -38,10 +38,9 @@ public @interface Plugin {
String EMPTY = Strings.EMPTY;
/**
- * Name of the plugin. If no name is specified, defaults to the simple class name of the annotated element.
- * Note that this name is case-insensitive.
+ * Name of the plugin. Note that this name is case-insensitive.
*/
- String name() default EMPTY;
+ String name();
/**
* Category to place the plugin under. Category names are case-sensitive.
---------------------------------------------------------------------
--
--
Matt Sicker
2014-06-04 05:00:38 UTC
Permalink
Yeah pretty much. The type converters will be @Plugins (in the
TypeConverters category; I've got a string constant), and they'll also have
a @ConvertType annotation that lists the class(es) it supports converting
to.
Post by Ralph Goers
If I understand what Matt is doing the new converters will be annotated
with the data type that they support, similar to how the pattern converters
are annotated with the pattern tokens used to identify them.
Ralph
At runtime just for the core or the whole CP? Performance?
Gary
-------- Original message --------
From: Matt Sicker
Date:06/03/2014 23:31 (GMT-05:00)
To: Log4J Developers List
Subject: Re: svn commit: r1599839 -
/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
Indeed.
Post by Ralph Goers
That sounds correct.
Ralph
processor this way, too.
Post by Ralph Goers
Why would you add a class attribute when the annotation is annotating
the class and you can get it from that?
Ralph
Author: mattsicker
Date: Tue Jun 3 23:50:29 2014
New Revision: 1599839
URL: http://svn.apache.org/r1599839
Revert that idea about the default name.
- Going to add an optional Class attribute instead.
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java?rev=1599839&r1=1599838&r2=1599839&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
Tue Jun 3 23:50:29 2014
@@ -38,10 +38,9 @@ public @interface Plugin {
String EMPTY = Strings.EMPTY;
/**
- * Name of the plugin. If no name is specified, defaults to the
simple class name of the annotated element.
- * Note that this name is case-insensitive.
+ * Name of the plugin. Note that this name is case-insensitive.
*/
- String name() default EMPTY;
+ String name();
/**
* Category to place the plugin under. Category names are
case-sensitive.
---------------------------------------------------------------------
--
--
--
Matt Sicker <***@gmail.com>
Gary Gregory
2014-06-04 05:37:51 UTC
Permalink
Post by Matt Sicker
TypeConverters category; I've got a string constant), and they'll also have
to.
Sounds promising, looking forward to seeing your work :-)

Gary
Post by Matt Sicker
Post by Ralph Goers
If I understand what Matt is doing the new converters will be annotated
with the data type that they support, similar to how the pattern converters
are annotated with the pattern tokens used to identify them.
Ralph
At runtime just for the core or the whole CP? Performance?
Gary
-------- Original message --------
From: Matt Sicker
Date:06/03/2014 23:31 (GMT-05:00)
To: Log4J Developers List
Subject: Re: svn commit: r1599839 -
/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
Indeed.
Post by Ralph Goers
That sounds correct.
Ralph
processor this way, too.
Post by Ralph Goers
Why would you add a class attribute when the annotation is annotating
the class and you can get it from that?
Ralph
Author: mattsicker
Date: Tue Jun 3 23:50:29 2014
New Revision: 1599839
URL: http://svn.apache.org/r1599839
Revert that idea about the default name.
- Going to add an optional Class attribute instead.
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java?rev=1599839&r1=1599838&r2=1599839&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
Tue Jun 3 23:50:29 2014
@@ -38,10 +38,9 @@ public @interface Plugin {
String EMPTY = Strings.EMPTY;
/**
- * Name of the plugin. If no name is specified, defaults to the
simple class name of the annotated element.
- * Note that this name is case-insensitive.
+ * Name of the plugin. Note that this name is case-insensitive.
*/
- String name() default EMPTY;
+ String name();
/**
* Category to place the plugin under. Category names are
case-sensitive.
---------------------------------------------------------------------
--
--
--
--
E-Mail: ***@gmail.com | ***@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
Matt Sicker
2014-09-14 23:27:59 UTC
Permalink
I had quite a hard time getting this idea to work back when I tried doing
this. Now that I've ripped some code from Spring <
https://github.com/spring-projects/spring-framework/blob/master/spring-core/src/main/java/org/springframework/util/TypeUtils.java>,
and now that I know a bit more about reflection over generics (it is indeed
as terrible as you think), I've been making quite a bit of progress towards
this. In fact, while typing this email, I forgot about it and finished the
feature!
Post by Gary Gregory
Post by Matt Sicker
TypeConverters category; I've got a string constant), and they'll also have
to.
Sounds promising, looking forward to seeing your work :-)
Gary
Post by Matt Sicker
Post by Ralph Goers
If I understand what Matt is doing the new converters will be annotated
with the data type that they support, similar to how the pattern converters
are annotated with the pattern tokens used to identify them.
Ralph
At runtime just for the core or the whole CP? Performance?
Gary
-------- Original message --------
From: Matt Sicker
Date:06/03/2014 23:31 (GMT-05:00)
To: Log4J Developers List
Subject: Re: svn commit: r1599839 -
/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
Indeed.
Post by Ralph Goers
That sounds correct.
Ralph
processor this way, too.
Post by Ralph Goers
Why would you add a class attribute when the annotation is annotating
the class and you can get it from that?
Ralph
Author: mattsicker
Date: Tue Jun 3 23:50:29 2014
New Revision: 1599839
URL: http://svn.apache.org/r1599839
Revert that idea about the default name.
- Going to add an optional Class attribute instead.
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java?rev=1599839&r1=1599838&r2=1599839&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
Tue Jun 3 23:50:29 2014
@@ -38,10 +38,9 @@ public @interface Plugin {
String EMPTY = Strings.EMPTY;
/**
- * Name of the plugin. If no name is specified, defaults to the
simple class name of the annotated element.
- * Note that this name is case-insensitive.
+ * Name of the plugin. Note that this name is case-insensitive.
*/
- String name() default EMPTY;
+ String name();
/**
* Category to place the plugin under. Category names are
case-sensitive.
---------------------------------------------------------------------
--
--
--
--
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
--
Matt Sicker <***@gmail.com>
Loading...