IMetaclass metaclass = XWT.getMetaclass(dataObject);
IProperty prop = metaclass.findProperty(propertyName);
if (prop != null && value != null) {
cacheData.property = prop;
Class<?> valueType = value.getClass();
IConverter converter = XWT.findConvertor(valueType, prop
.getType());
Object trueValue = value;
if (converter != null) {
trueValue = converter.convert(trueValue);
}
cacheData.value = trueValue;
try {
Object existingValue = prop.getValue(dataObject);
return Operator.compare(existingValue, operator, trueValue);
} catch (Exception e) {
LoggerManager.log(e);
}
}
} else if (binding != null) {
Object existingValue = binding.getValue(null);
if (existingValue == null) {
return false;
}
while (existingValue instanceof IObservableValue) {
existingValue = ((IObservableValue) existingValue).getValue();
}
Class<?> existingValueType = existingValue.getClass();
Class<?> valueType = value.getClass();
Object normalizedValue = value;
if (!existingValueType.isAssignableFrom(valueType) && !valueType.isAssignableFrom(existingValueType)) {
IConverter converter = XWT.findConvertor(valueType, existingValueType);
if (converter != null) {
normalizedValue = converter.convert(normalizedValue);
}
else if (value.toString().trim().length() > 0){
boolean found = false;
// in case where the value is a boolean
converter = XWT.findConvertor(valueType, Boolean.class);
if (converter != null) {
try {
Object booleanValue = converter.convert(value);
if (booleanValue != null) {
converter = XWT.findConvertor(existingValueType, Boolean.class);
if (converter != null) {
existingValue = converter.convert(existingValue);
normalizedValue = booleanValue;
found = true;
}
}
} catch (RuntimeException e) {
}
}
if (!found) {
converter = XWT.findConvertor(valueType, int.class);
if (converter != null) {
try {
Object booleanValue = converter.convert(value);
if (booleanValue != null) {
converter = XWT.findConvertor(existingValueType, int.class);
if (converter != null) {
existingValue = converter.convert(existingValue);
normalizedValue = booleanValue;
found = true;
}
}
} catch (Exception e) {
}
}
}
if (!found) {
converter = XWT.findConvertor(valueType, double.class);
if (converter != null) {
try {
Object booleanValue = converter.convert(value);
if (booleanValue != null) {
converter = XWT.findConvertor(existingValueType, double.class);
if (converter != null) {
existingValue = converter.convert(existingValue);
normalizedValue = booleanValue;
found = true;
}
}
} catch (Exception e) {
}
}
}
if (!found) {
converter = XWT.findConvertor(valueType, String.class);
if (converter != null) {
try {
Object booleanValue = converter.convert(value);
if (booleanValue != null) {
converter = XWT.findConvertor(existingValueType, String.class);
if (converter != null) {
existingValue = converter.convert(existingValue);
normalizedValue = booleanValue;
found = true;
}
}
} catch (Exception e) {