validation/validation-api/src/main/java/se/jguru/nazgul/tools/validation/api/expression/ExpressionBuilder.java
public ExpressionBuilder notNullOrEmpty(final Object property, final String name) {

        notNull(property, name);

        if (property instanceof String && ((String) property).isEmpty()) {
            messageContainer.addErrorMessage("Property '" + name + "' cannot be empty.");
        }
        if (property instanceof Collection && ((Collection<?>) property).isEmpty()) {
            messageContainer.addErrorMessage("Collection '" + name + "' must contain elements.");
        }
        if (property instanceof Map && ((Map<?, ?>) property).isEmpty()) {
            messageContainer.addErrorMessage("Map '" + name + "' must contain elements.");
        }

        return this;
    }
public ExpressionBuilder notNullOrEmpty(final Object property, final String name) {

        notNull(property, name);

        if (property instanceof String && ((String) property).isEmpty()) {
            messageContainer.addErrorMessage("Property '" + name + "' cannot be empty.");
        }
        if (property instanceof Collection && ((Collection<?>) property).isEmpty()) {
            messageContainer.addErrorMessage("Collection '" + name + "' must contain elements.");
        }
        if (property instanceof Map && ((Map<?, ?>) property).isEmpty()) {
            messageContainer.addErrorMessage("Map '" + name + "' must contain elements.");
        }

        return this;
    }
public ExpressionBuilder notNullOrEmpty ( final Object property , final String name ) { notNull ( property , name ) ; if ( property instanceof String && ( ( String ) property ) . isEmpty ( ) ) { messageContainer . addErrorMessage ( "Property '" + name + "' cannot be empty." ) ; } if ( property instanceof Collection && ( ( Collection < ? > ) property ) . isEmpty ( ) ) { messageContainer . addErrorMessage ( "Collection '" + name + "' must contain elements." ) ; } if ( property instanceof Map && ( ( Map < ? , ? > ) property ) . isEmpty ( ) ) { messageContainer . addErrorMessage ( "Map '" + name + "' must contain elements." ) ; } return this ; }
Adds a description for a null or empty property (Strings, Collections and Maps are
checked for emptyness as well as null-ness).

@param property The property to check.
@param name     The property name.
@return This object.
Adds a description for a null or empty property ( Strings Collections and Maps are checked for emptyness as well as null - ness ) .