> I know that newState is State type, so in the first rule it will be
> DecimalType and in the second one will be StringType. So, do you know
> why StringTypes are never equal in rules? Is there a bug in equal
> method, maybe?
i added a new StringTypeTest UnitTest which proofs, that hashCode() and equals() are working as expected. Unfortunately i am no drools-expert so i cannot help with the StateEvent-Problem.
Regards,
Thomas E.-E.
I guess the difference here is that DecimalType extends "Number" and
thus Drools can figure out how to apply compare methods on it.
StringType in contrast does not extend "String" (as this is final) and
hence Drools has no idea how to compare instances of that type. Maybe
it would help if we implement the interface CharSequence (or even
Comparable<String>) in the StringType?
> On 9 feb, 20:54, Thomas Eichstädt-Engelen <teich...@googlemail.com>
> wrote:
>> Hi Juanker,
>>
>> > I know that newState is State type, so in the first rule it will be
>> > DecimalType and in the second one will be StringType. So, do you know
>> > why StringTypes are never equal in rules? Is there a bug in equal
>> > method, maybe?
>>
>> i added a new StringTypeTest UnitTest which proofs, that hashCode()
>> and equals() are working as expected. Unfortunately i am no
>> drools-expert so i cannot help with the StateEvent-Problem.
>>
>> Regards,
>>
>> Thomas E.-E.
>
> --
> You received this message because you are subscribed to the Google
> Groups "openhab" group.
> To post to this group, send email to ope...@googlegroups.com.
> To unsubscribe from this group, send email to
> openhab+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/openhab?hl=en.
>
>
I have just pushed a change so that the StringType.equals() method works as expected when passing a java.lang.String.