So the bummer is that this redundant with the arg type in the signature:

@PluginAttributeInt (value="foo", defaultInt=1) int foo

We should also pick up the attribute name by reflection if it is missing from 
the annotation.

But you'd only need it to spec a default value.  So could we keep 
PluginAttribute with only a value and then have an annotation for each default 
value type? @DefaultInt and so on..?

Ideally:

@PluginAttribute() @DefaultInt (1) int foo

Thoughts? 

Gary

<div>-------- Original message --------</div><div>From: Paul Benedict 
<[email protected]> </div><div>Date:05/30/2014  22:15  (GMT-05:00) 
</div><div>To: Apache Log4J Developers <[email protected]> 
</div><div>Subject: Re: PluginAttribute#defaultEnum()? </div><div>
</div>Totally cleaner.

On May 30, 2014 8:58 PM, "Gary Gregory" <[email protected]> wrote:
On Fri, May 30, 2014 at 9:39 PM, Paul Benedict <[email protected]> wrote:
I think you guys are better off doing separate annotations to do strong typing. 
You could use a stereotyping pattern like Bean Validation spec.

public @interface PluginAttribute ...

Then annotate other annotations with that:
@PluginAttribute
public @interface IntPluginAttribute


I did propose that earlier ;-) It seems much cleaner...

Gary
 
See how the Been Validation spec works to copy their pattern.

On May 30, 2014 7:55 PM, "Gary Gregory" <[email protected]> wrote:
Hm... you cannot use Enum in the return type for an annotation attribute, only 
an actual enum, like RetentionPolicy. So it seems a no-go.

Gary


On Fri, May 30, 2014 at 4:24 PM, Matt Sicker <[email protected]> wrote:
I had the same hold-up when thinking about adding that, too. How about 
RetentionPolicy.SOURCE? Or ElementType.TYPE? Something annotation-related like 
that.


On 30 May 2014 13:12, Gary Gregory <[email protected]> wrote:
I added PluginAttribute#defaultClass() since we can have a Class has an 
attribute value.

One can also have an Enum as an attribute value, but what default should be use?

Gary

-- 
E-Mail: [email protected] | [email protected] 
Java Persistence with Hibernate, Second Edition
JUnit in Action, Second Edition
Spring Batch in Action
Blog: http://garygregory.wordpress.com 
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory



-- 
Matt Sicker <[email protected]>



-- 
E-Mail: [email protected] | [email protected] 
Java Persistence with Hibernate, Second Edition
JUnit in Action, Second Edition
Spring Batch in Action
Blog: http://garygregory.wordpress.com 
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory



-- 
E-Mail: [email protected] | [email protected] 
Java Persistence with Hibernate, Second Edition
JUnit in Action, Second Edition
Spring Batch in Action
Blog: http://garygregory.wordpress.com 
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Reply via email to