|
From: Michael B. <mic...@gm...> - 2008-11-13 17:05:02
|
Hi, Now that we have StringConverter, what about object defaults? Unfortunately @DefaultValue only accepts a String, so that would mean another resteasy extension. Michael Brackx |
|
From: Bill B. <bb...@re...> - 2008-11-13 17:51:19
|
I looked at the code and it seems that the @DefaultValue is run through the converter. Are you not seeing that behavior? Michael Brackx wrote: > Hi, > > Now that we have StringConverter, what about object defaults? > Unfortunately @DefaultValue only accepts a String, so that would mean > another resteasy extension. > > Michael Brackx > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-developers -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Michael B. <mic...@gm...> - 2008-11-13 17:57:24
|
On Thu, Nov 13, 2008 at 6:51 PM, Bill Burke <bb...@re...> wrote:
> I looked at the code and it seems that the @DefaultValue is run through the
> converter. Are you not seeing that behavior?
Yes i do (actually, i added a test case for that)
What i meant is not specifying the default as string, but as an object.
@DefaultValue(new Pojo("default"))
otherwise you would need to convert the value yourself
@DefaultValue(new PojoStingConverter().toString(new Pojo("default")))
Michael Brackx
>
> Michael Brackx wrote:
>>
>> Hi,
>>
>> Now that we have StringConverter, what about object defaults?
>> Unfortunately @DefaultValue only accepts a String, so that would mean
>> another resteasy extension.
>>
>> Michael Brackx
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Resteasy-developers mailing list
>> Res...@li...
>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
|
|
From: Bill B. <bb...@re...> - 2008-11-13 18:09:43
|
Michael Brackx wrote:
> On Thu, Nov 13, 2008 at 6:51 PM, Bill Burke <bb...@re...> wrote:
>> I looked at the code and it seems that the @DefaultValue is run through the
>> converter. Are you not seeing that behavior?
>
> Yes i do (actually, i added a test case for that)
> What i meant is not specifying the default as string, but as an object.
>
> @DefaultValue(new Pojo("default"))
>
> otherwise you would need to convert the value yourself
>
> @DefaultValue(new PojoStingConverter().toString(new Pojo("default")))
>
Both are illegal. You can only use primitive constants within
annotations as they are compiled directly into the bytecode.
Bill
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Michael B. <mic...@gm...> - 2008-11-13 18:22:16
|
@DefaultValue(DefaultPojo.class) ?
Probably not that useful.
@DefaultValue(DefaultPojoFactory.class) ?
@DefaultValue(useProvider = true)
@DefaultValue()
and a new provider interface ?
public interface DefaultValueProvider<T> {
T get();
}
Michael Brackx
On Thu, Nov 13, 2008 at 7:09 PM, Bill Burke <bb...@re...> wrote:
>
>
> Michael Brackx wrote:
>>
>> On Thu, Nov 13, 2008 at 6:51 PM, Bill Burke <bb...@re...> wrote:
>>>
>>> I looked at the code and it seems that the @DefaultValue is run through
>>> the
>>> converter. Are you not seeing that behavior?
>>
>> Yes i do (actually, i added a test case for that)
>> What i meant is not specifying the default as string, but as an object.
>>
>> @DefaultValue(new Pojo("default"))
>>
>> otherwise you would need to convert the value yourself
>>
>> @DefaultValue(new PojoStingConverter().toString(new Pojo("default")))
>>
>
> Both are illegal. You can only use primitive constants within annotations
> as they are compiled directly into the bytecode.
>
> Bill
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
|
|
From: Bill B. <bb...@re...> - 2008-11-13 18:55:28
|
Ok, but not until next release. I want to release on Monday and begin
the TCK work.
Michael Brackx wrote:
> @DefaultValue(DefaultPojo.class) ?
> Probably not that useful.
>
> @DefaultValue(DefaultPojoFactory.class) ?
>
> @DefaultValue(useProvider = true)
> @DefaultValue()
> and a new provider interface ?
>
> public interface DefaultValueProvider<T> {
> T get();
> }
>
> Michael Brackx
>
> On Thu, Nov 13, 2008 at 7:09 PM, Bill Burke <bb...@re...> wrote:
>>
>> Michael Brackx wrote:
>>> On Thu, Nov 13, 2008 at 6:51 PM, Bill Burke <bb...@re...> wrote:
>>>> I looked at the code and it seems that the @DefaultValue is run through
>>>> the
>>>> converter. Are you not seeing that behavior?
>>> Yes i do (actually, i added a test case for that)
>>> What i meant is not specifying the default as string, but as an object.
>>>
>>> @DefaultValue(new Pojo("default"))
>>>
>>> otherwise you would need to convert the value yourself
>>>
>>> @DefaultValue(new PojoStingConverter().toString(new Pojo("default")))
>>>
>> Both are illegal. You can only use primitive constants within annotations
>> as they are compiled directly into the bytecode.
>>
>> Bill
>>
>> --
>> Bill Burke
>> JBoss, a division of Red Hat
>> http://bill.burkecentral.com
>>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Michael B. <mic...@gm...> - 2008-11-13 19:09:33
|
On Thu, Nov 13, 2008 at 7:55 PM, Bill Burke <bb...@re...> wrote: > Ok, but not until next release. I want to release on Monday and begin the > TCK work. No problem. I was just "thinking out loud". The problem with a DefaultValueProvider is that you can only have default value one per type. Unless you pass some (primitive) parameters with the annotation. Also, it is less clear than a constant. Michael |