[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2924) Planner: make it scala friendly and avoid casting in Solution.setScore() implementation: Solution interface gets a type S extend Score so Solution.getScore() returns S and Solution.setScore() now has a parameter S

Geoffrey De Smet (JIRA) jira-events at lists.jboss.org
Sun Mar 13 08:21:45 EDT 2011


    [ https://issues.jboss.org/browse/JBRULES-2924?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12587589#comment-12587589 ] 

Geoffrey De Smet commented on JBRULES-2924:
-------------------------------------------

[MAJOR] Solution now has a generic type of Score: Solution<S extends Score> (JBRULES-2924)
Your Solution implementation itself should not be generic, but it should define it's Score type through implements.
Before in *.java if you use a SimpleScore:
    public class ... implements Solution {
        ...
        public void setScore(Score score) {
            this.score = (SimpleScore) score;
        }
        ...
    }
After in *.java if you use a SimpleScore:
    public class ... implements Solution<SimpleScore> {
        ...
        public void setScore(SimpleScore score) {
            this.score = score;
        }
        ...
    }
Before in *.java if you use a HardAndSoftScore:
    public class ... implements Solution {
        ...
        public void setScore(Score score) {
            this.score = (HardAndSoftScore) score;
        }
        ...
    }
After in *.java if you use a HardAndSoftScore:
    public class ... implements Solution<HardAndSoftScore> {
        ...
        public void setScore(HardAndSoftScore score) {
            this.score = score;
        }
        ...
    }

> Planner: make it scala friendly and avoid casting in Solution.setScore() implementation: Solution interface gets a type S extend Score so Solution.getScore() returns S and Solution.setScore() now has a parameter S
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JBRULES-2924
>                 URL: https://issues.jboss.org/browse/JBRULES-2924
>             Project: Drools
>          Issue Type: Enhancement
>      Security Level: Public(Everyone can see) 
>          Components: drools-planner
>            Reporter: Geoffrey De Smet
>            Assignee: Geoffrey De Smet
>             Fix For: 5.2.0.M2
>
>
> See
> http://stackoverflow.com/questions/5279149/implementing-methods-having-raw-types-in-scala

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


More information about the jboss-jira mailing list