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

Andera Del Bene commented on WICKET-3866:
-----------------------------------------

If you use a model which implements IPropertyReflectionAwareModel constructor 
like 'new TextField<Integer>("integer", integerModel)' is enough. This 
interface is implemented only by PropertyModel, but CompoundPropertyModel uses 
PropertyModel and it seems "smart" enough to infer model type.

Anyway, why not implement a more flexible model type inferring mechanism?   
Currently type inferring is done in private method getModelType inside 
AbstractTextComponent class, but is performed only if Model class implements  
IPropertyReflectionAwareModel, otherwise return null.

Why not simply return something like: getObject() != null ? 
getObject().getClass() : null ?


> Typecasted TextField ignores given Type
> ---------------------------------------
>
>                 Key: WICKET-3866
>                 URL: https://issues.apache.org/jira/browse/WICKET-3866
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.4.17, 1.5-RC5.1
>         Environment: Windows 7, JDK 1.6.0_26
>            Reporter: Paul
>         Attachments: quickstart.zip
>
>
> Hi,
> while reading a Integer from a typecasted TextField I realised Wicket ignores 
> the given Type and asumes a String. Only way to get another Type is to call 
> the Function setType(). But using a typed contructor the usage of setType() 
> should be obsolete and the TextField should assume the given type.
> I attached a Quickstart. Simply have a look at the HomePage and comment out 
> Line 29.
> Cheers
> Paul

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to