excludeBlanks in Example Criteria
---------------------------------
Key: HHH-2561
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2561
Project: Hibernate3
Issue Type: Improvement
Components: core
Reporter: Daniel Passos
Priority: Trivial
Which the possiblidade to add in org.hibernate.criterion.Example a new method to ignore
all properties with values is blank?
private static final PropertySelector NOT_NULL_OR_BLANK = new
NotNullOrBlankPropertySelector();
static final class NotNullOrBlankPropertySelector implements PropertySelector {
public boolean include(Object object, String propertyName, Type type) {
return object!=null && (
!(object instanceof String) || !( (String) object ).equals("")
);
}
}
/**
* Exclude blank ("") String properties
*/
public Example excludeBlanks() {
setPropertySelector(NOT_NULL_OR_BLANK);
return this;
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira