se.js.jesdob.query.condition
Class AttrContainsCondition

java.lang.Object
  extended by se.js.jesdob.query.condition.AttrContainsCondition
All Implemented Interfaces:
ICondition

public class AttrContainsCondition
extends java.lang.Object
implements ICondition

A Condition for checking if a IDob contains a specific attribute, and if this attribute contains a specific value or not.


Constructor Summary
AttrContainsCondition(java.lang.String attribute, java.lang.String value)
          Constructor.
 
Method Summary
 boolean isTrue(IDob dob)
          Returns true or false, depending on if the supplied IDob-object contains the specified attribute, and if this attribute contains the supplied value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttrContainsCondition

public AttrContainsCondition(java.lang.String attribute,
                             java.lang.String value)
Constructor.

Parameters:
attribute - The attribute we want to check the value for.
value - The value we want to check if the attribute contains.
Method Detail

isTrue

public boolean isTrue(IDob dob)
Returns true or false, depending on if the supplied IDob-object contains the specified attribute, and if this attribute contains the supplied value. If the dob has not the attribute, the condition will return false. If the dob has the attribute, but the value of the attribute is not the supplied value, the rule will return false. If the dob has the attribute, and the value equals the supplied value, the rule will return true. If the dob has the attribute, and the value contains the supplied value, the rule will return true. The dob-attribute-values doesn't have to equal the supplied value exactly, but can contain the value. Example: value = "def" "abcdefghijklm" - true, contains "def". "def" - true, contains "def". "abcde" - false, does not contain "def".

Specified by:
isTrue in interface ICondition
Parameters:
dob - The IDob to test.
Returns:
True or false, depending on if the condition is true for the IDob-object or not.