polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject Re: UseDefaults with custom default value?
Date Fri, 15 Apr 2016 07:40:11 GMT
But the problem is that 'value' has a type and limited to primitives, class
and String (IIRC), so it would need to be String and have a deserializer to
the actual type. Doable, but in your example it would be;

 @UseDefaults(value="8080")
 Property<Integer> port();

and "value" is not actually needed, so

 @UseDefaults("8080")
 Property<Integer> port();



On Fri, Apr 15, 2016 at 3:37 PM, Niclas Hedhman <niclas@hedhman.org> wrote:

> No, I don't think this has been implemented. A neat idea idea, though. Add
> a Jira if you want to see it implemented (or implement it for us ;-) )
>
> On Fri, Apr 15, 2016 at 3:11 PM, zhuangmz08 <zhuangmz08@qq.com> wrote:
>
>> Hi,
>>   Could I define default value where I declare the Property, such as:
>>
>>
>> public interface ABC {
>>    @UseDefaults(value="127.0.0.1")
>>    Property<String> hostname();
>>
>>
>>    @UseDefaults(value=8080)
>>    Property<Integer> port();
>> }
>>
>>
>> Thanks a lot.
>
>
>
>
> --
> Niclas Hedhman, Software Developer
> http://zest.apache.org - New Energy for Java
>



-- 
Niclas Hedhman, Software Developer
http://zest.apache.org - New Energy for Java

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message