You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martijn Dashorst <ma...@gmail.com> on 2014/01/31 13:44:16 UTC
Wicket 7: PropertyColumn#getDataModel() signature error?
public class PropertyColumn<T, S> extends AbstractColumn<T, S> implements
IExportableColumn<T, S, Object>
{
...
/**
* Factory method for generating a model that will generated the displayed
value. Typically the
* model is a property model using the {@link #propertyExpression}
specified in the constructor.
*
* @param rowModel
* @return model
*/
@Override
public IModel<Object> getDataModel(IModel<T> rowModel)
{
PropertyModel<Object> propertyModel = new PropertyModel<>(rowModel,
propertyExpression);
return propertyModel;
}
}
Should the return type getDataModel(IModel<T> rowModel) rather be IModel<?>
? It is now impossible to return Model.of("foo") for instance, as
Model<String> can't be cast to IModel<Object>
Martijn
Re: Wicket 7: PropertyColumn#getDataModel() signature error?
Posted by Martin Grigorov <mg...@apache.org>.
Thanks for testing 7.x and giving feedback !
On Mon, Feb 3, 2014 at 11:28 AM, Martijn Dashorst <
martijn.dashorst@gmail.com> wrote:
> It dawned upon me that my usage of property column was flawed in the
> application, so I modified my application to use AbstractColumn instead.
>
> Nevertheless the typing seamed flawed to me. Thanks for looking deeper into
> it.
>
> Martijn
>
>
> On Mon, Feb 3, 2014 at 10:44 AM, Martin Grigorov <mgrigorov@apache.org
> >wrote:
>
> > As discussed in WICKET-4802 the third type parameter for
> IExportableColumn
> > is not really needed and has been removed.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> >
> >
> > On Sun, Feb 2, 2014 at 10:37 AM, Martin Grigorov <mgrigorov@apache.org
> > >wrote:
> >
> > > The problem is that
> > > public class PropertyColumn<T, S> extends AbstractColumn<T, S>
> implements
> > > IExportableColumn<T, S, *Object*> mandates that return type.
> > > The only correct way to fix this is to add third type parameter to
> > > PropertyColumn: PropertyColumn<T, S, *D*>.
> > > This will lead to compile errors and will require every app to add the
> > > third type in 7.x.
> > > Related ticket is: https://issues.apache.org/jira/browse/WICKET-4802
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > >
> > >
> > > On Fri, Jan 31, 2014 at 2:48 PM, Martin Grigorov <mgrigorov@apache.org
> > >wrote:
> > >
> > >> It looks like an error.
> > >>
> > >>
> > >> On Fri, Jan 31, 2014 at 1:44 PM, Martijn Dashorst <
> > >> martijn.dashorst@gmail.com> wrote:
> > >>
> > >>> public class PropertyColumn<T, S> extends AbstractColumn<T, S>
> > implements
> > >>> IExportableColumn<T, S, Object>
> > >>> {
> > >>> ...
> > >>>
> > >>> /**
> > >>> * Factory method for generating a model that will generated the
> > >>> displayed
> > >>> value. Typically the
> > >>> * model is a property model using the {@link #propertyExpression}
> > >>> specified in the constructor.
> > >>> *
> > >>> * @param rowModel
> > >>> * @return model
> > >>> */
> > >>> @Override
> > >>> public IModel<Object> getDataModel(IModel<T> rowModel)
> > >>> {
> > >>> PropertyModel<Object> propertyModel = new PropertyModel<>(rowModel,
> > >>> propertyExpression);
> > >>> return propertyModel;
> > >>> }
> > >>> }
> > >>>
> > >>>
> > >>> Should the return type getDataModel(IModel<T> rowModel) rather be
> > >>> IModel<?>
> > >>> ? It is now impossible to return Model.of("foo") for instance, as
> > >>> Model<String> can't be cast to IModel<Object>
> > >>>
> > >>> Martijn
> > >>>
> > >>
> > >>
> > >
> >
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
>
Re: Wicket 7: PropertyColumn#getDataModel() signature error?
Posted by Martijn Dashorst <ma...@gmail.com>.
It dawned upon me that my usage of property column was flawed in the
application, so I modified my application to use AbstractColumn instead.
Nevertheless the typing seamed flawed to me. Thanks for looking deeper into
it.
Martijn
On Mon, Feb 3, 2014 at 10:44 AM, Martin Grigorov <mg...@apache.org>wrote:
> As discussed in WICKET-4802 the third type parameter for IExportableColumn
> is not really needed and has been removed.
>
> Martin Grigorov
> Wicket Training and Consulting
>
>
> On Sun, Feb 2, 2014 at 10:37 AM, Martin Grigorov <mgrigorov@apache.org
> >wrote:
>
> > The problem is that
> > public class PropertyColumn<T, S> extends AbstractColumn<T, S> implements
> > IExportableColumn<T, S, *Object*> mandates that return type.
> > The only correct way to fix this is to add third type parameter to
> > PropertyColumn: PropertyColumn<T, S, *D*>.
> > This will lead to compile errors and will require every app to add the
> > third type in 7.x.
> > Related ticket is: https://issues.apache.org/jira/browse/WICKET-4802
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> >
> >
> > On Fri, Jan 31, 2014 at 2:48 PM, Martin Grigorov <mgrigorov@apache.org
> >wrote:
> >
> >> It looks like an error.
> >>
> >>
> >> On Fri, Jan 31, 2014 at 1:44 PM, Martijn Dashorst <
> >> martijn.dashorst@gmail.com> wrote:
> >>
> >>> public class PropertyColumn<T, S> extends AbstractColumn<T, S>
> implements
> >>> IExportableColumn<T, S, Object>
> >>> {
> >>> ...
> >>>
> >>> /**
> >>> * Factory method for generating a model that will generated the
> >>> displayed
> >>> value. Typically the
> >>> * model is a property model using the {@link #propertyExpression}
> >>> specified in the constructor.
> >>> *
> >>> * @param rowModel
> >>> * @return model
> >>> */
> >>> @Override
> >>> public IModel<Object> getDataModel(IModel<T> rowModel)
> >>> {
> >>> PropertyModel<Object> propertyModel = new PropertyModel<>(rowModel,
> >>> propertyExpression);
> >>> return propertyModel;
> >>> }
> >>> }
> >>>
> >>>
> >>> Should the return type getDataModel(IModel<T> rowModel) rather be
> >>> IModel<?>
> >>> ? It is now impossible to return Model.of("foo") for instance, as
> >>> Model<String> can't be cast to IModel<Object>
> >>>
> >>> Martijn
> >>>
> >>
> >>
> >
>
--
Become a Wicket expert, learn from the best: http://wicketinaction.com
Re: Wicket 7: PropertyColumn#getDataModel() signature error?
Posted by Martin Grigorov <mg...@apache.org>.
As discussed in WICKET-4802 the third type parameter for IExportableColumn
is not really needed and has been removed.
Martin Grigorov
Wicket Training and Consulting
On Sun, Feb 2, 2014 at 10:37 AM, Martin Grigorov <mg...@apache.org>wrote:
> The problem is that
> public class PropertyColumn<T, S> extends AbstractColumn<T, S> implements
> IExportableColumn<T, S, *Object*> mandates that return type.
> The only correct way to fix this is to add third type parameter to
> PropertyColumn: PropertyColumn<T, S, *D*>.
> This will lead to compile errors and will require every app to add the
> third type in 7.x.
> Related ticket is: https://issues.apache.org/jira/browse/WICKET-4802
>
> Martin Grigorov
> Wicket Training and Consulting
>
>
> On Fri, Jan 31, 2014 at 2:48 PM, Martin Grigorov <mg...@apache.org>wrote:
>
>> It looks like an error.
>>
>>
>> On Fri, Jan 31, 2014 at 1:44 PM, Martijn Dashorst <
>> martijn.dashorst@gmail.com> wrote:
>>
>>> public class PropertyColumn<T, S> extends AbstractColumn<T, S> implements
>>> IExportableColumn<T, S, Object>
>>> {
>>> ...
>>>
>>> /**
>>> * Factory method for generating a model that will generated the
>>> displayed
>>> value. Typically the
>>> * model is a property model using the {@link #propertyExpression}
>>> specified in the constructor.
>>> *
>>> * @param rowModel
>>> * @return model
>>> */
>>> @Override
>>> public IModel<Object> getDataModel(IModel<T> rowModel)
>>> {
>>> PropertyModel<Object> propertyModel = new PropertyModel<>(rowModel,
>>> propertyExpression);
>>> return propertyModel;
>>> }
>>> }
>>>
>>>
>>> Should the return type getDataModel(IModel<T> rowModel) rather be
>>> IModel<?>
>>> ? It is now impossible to return Model.of("foo") for instance, as
>>> Model<String> can't be cast to IModel<Object>
>>>
>>> Martijn
>>>
>>
>>
>
Re: Wicket 7: PropertyColumn#getDataModel() signature error?
Posted by Martin Grigorov <mg...@apache.org>.
The problem is that
public class PropertyColumn<T, S> extends AbstractColumn<T, S> implements
IExportableColumn<T, S, *Object*> mandates that return type.
The only correct way to fix this is to add third type parameter to
PropertyColumn: PropertyColumn<T, S, *D*>.
This will lead to compile errors and will require every app to add the
third type in 7.x.
Related ticket is: https://issues.apache.org/jira/browse/WICKET-4802
Martin Grigorov
Wicket Training and Consulting
On Fri, Jan 31, 2014 at 2:48 PM, Martin Grigorov <mg...@apache.org>wrote:
> It looks like an error.
>
>
> On Fri, Jan 31, 2014 at 1:44 PM, Martijn Dashorst <
> martijn.dashorst@gmail.com> wrote:
>
>> public class PropertyColumn<T, S> extends AbstractColumn<T, S> implements
>> IExportableColumn<T, S, Object>
>> {
>> ...
>>
>> /**
>> * Factory method for generating a model that will generated the displayed
>> value. Typically the
>> * model is a property model using the {@link #propertyExpression}
>> specified in the constructor.
>> *
>> * @param rowModel
>> * @return model
>> */
>> @Override
>> public IModel<Object> getDataModel(IModel<T> rowModel)
>> {
>> PropertyModel<Object> propertyModel = new PropertyModel<>(rowModel,
>> propertyExpression);
>> return propertyModel;
>> }
>> }
>>
>>
>> Should the return type getDataModel(IModel<T> rowModel) rather be
>> IModel<?>
>> ? It is now impossible to return Model.of("foo") for instance, as
>> Model<String> can't be cast to IModel<Object>
>>
>> Martijn
>>
>
>
Re: Wicket 7: PropertyColumn#getDataModel() signature error?
Posted by Martin Grigorov <mg...@apache.org>.
It looks like an error.
On Fri, Jan 31, 2014 at 1:44 PM, Martijn Dashorst <
martijn.dashorst@gmail.com> wrote:
> public class PropertyColumn<T, S> extends AbstractColumn<T, S> implements
> IExportableColumn<T, S, Object>
> {
> ...
>
> /**
> * Factory method for generating a model that will generated the displayed
> value. Typically the
> * model is a property model using the {@link #propertyExpression}
> specified in the constructor.
> *
> * @param rowModel
> * @return model
> */
> @Override
> public IModel<Object> getDataModel(IModel<T> rowModel)
> {
> PropertyModel<Object> propertyModel = new PropertyModel<>(rowModel,
> propertyExpression);
> return propertyModel;
> }
> }
>
>
> Should the return type getDataModel(IModel<T> rowModel) rather be IModel<?>
> ? It is now impossible to return Model.of("foo") for instance, as
> Model<String> can't be cast to IModel<Object>
>
> Martijn
>