[ 
http://jira.magnolia-cms.com/browse/MGNLSTK-688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Federico Grilli reopened MGNLSTK-688:
-------------------------------------


Maybe I was too rushed into resolving this. As far as I can understand, binary 
compatibility will not be an issue but backward compatibility will. If fact, if 
someone has extended {{STKTemplateModel}} like this
{code}
class Foo extends STKTemplateModel{

        public Foo(Content content, STKTemplate definition, RenderingModel 
parent) {
                super(content, definition, parent);
        }

        @Override
        public String execute() {
                STKTemplate template = getDefinition();
                //do something here
                return super.execute();
        }

}
{code}
when they will upgrade to the latest stk they will incur in compilation issues 
as {{getDefinition()}} will either need a cast or their custom template model 
will need to specify the type like this {{class Foo extends 
STKTemplateModel<STKTemplate}}

> Minor generics improvement
> --------------------------
>
>                 Key: MGNLSTK-688
>                 URL: http://jira.magnolia-cms.com/browse/MGNLSTK-688
>             Project: Magnolia Standard Templating Kit
>          Issue Type: Improvement
>          Components: base system
>    Affects Versions: 1.3, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5
>            Reporter: Roelof Jan
>            Assignee: Federico Grilli
>             Fix For: 1.4.2
>
>         Attachments: MGNLSTK-688-1.patch, MGNLSTK-688-2.patch, 
> MGNLSTK-688-STK.patch, MGNLSTK-688-Templating.patch, RenderingModelImpl.java, 
> STKTemplateModel.java
>
>
> I ran into some issues concerning the use of generics: 
> public class RenderingModelImpl<RD extends RenderableDefinition> implements 
> RenderingModel
> shouldn't this be 
> public class RenderingModelImpl<RD extends RenderableDefinition> implements 
> RenderingModel<RD>
> When this is fixed it would be nice to be able to subclass both 
> STKTemplateModel and STKTemplate while being able to access operations on the 
> STKTemplate subclass by getDefinition() on the model class. After the 
> previous fix this would possible without braking anything.
> Change:
> public class STKTemplateModel extends RenderingModelImpl<STKTemplate>
> to 
> public class STKTemplateModel<RD extends STKTemplate> extends 
> RenderingModelImpl<RD>
> using this constructor:     
> public STKTemplateModel(Content content, RD definition, RenderingModel 
> parent) {
>         super(content, definition, parent);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to