Skip to content

Commit

Permalink
ERXKeyValueQualifier should try valueForKeyPath if valueForKey doesn'…
Browse files Browse the repository at this point in the history
…t return a value
  • Loading branch information
darkv authored and Pascal Robert committed Apr 30, 2012
1 parent f167473 commit c6faf31
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,18 @@ public void addQualifierKeysToSet(NSMutableSet arg0) {
@SuppressWarnings("unchecked")
public boolean evaluateWithObject(Object object) {
boolean result = false;
if ( ( object != null ) && ( ( object instanceof NSKeyValueCoding ) == true ) ) {
Object obj = ((NSKeyValueCoding)object).valueForKey(this.key());
if (object != null && object instanceof NSKeyValueCoding) {
Object obj = ((NSKeyValueCoding)object).valueForKey(key());
if (obj == null && object instanceof NSKeyValueCodingAdditions) {
obj = ((NSKeyValueCodingAdditions)object).valueForKeyPath(key());
}
if (obj instanceof NSArray) {
NSArray objArray = (NSArray)obj;
int objArrayCount = objArray.count();
if (objArrayCount > 0) {
if (!objArray.isEmpty()) {
if(_minCount == 0) {
result = ERXArrayUtilities.arrayContainsArray(objArray, elements());
} else {
return ERXArrayUtilities.intersectingElements(objArray, elements()).count() >= _minCount;
result = ERXArrayUtilities.intersectingElements(objArray, elements()).count() >= _minCount;
}
}
}
Expand Down

0 comments on commit c6faf31

Please sign in to comment.