[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2561) excludeBlanks in Example Criteria

Daniel Passos (JIRA) noreply at atlassian.com
Fri Apr 13 14:08:04 EDT 2007


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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list