<commit_before>package jpaoletti.jpm.validator;

import jpaoletti.jpm.core.PMContext;
import jpaoletti.jpm.core.message.MessageFactory;

/**Validate that the specified field is not null
 * 
 * <h2>Simple entity configuration file</h2>
 * <pre>
 * {@code
 * <field>
 *     <id>some_id</id>
 *     ....
 *     <validator class="jpaoletti.jpm.validator.NotNull" />
 * </field>
 * }
 * </pre>
 * @author jpaoletti
 * */
public class NotNull extends ValidatorSupport {

    /**The validation method*/
    @Override
    public ValidationResult validate(PMContext ctx) {
        final ValidationResult res = new ValidationResult();
        final Object fieldvalue = ctx.getFieldValue();
        res.setSuccessful(fieldvalue != null);
        if (!res.isSuccessful()) {
            res.getMessages().add(MessageFactory.error(
                    ctx.getEntity(), ctx.getField(),
                    get("msg", "void"),
                    ctx.getField().getId()));
        }
        return res;
    }
}
<commit_msg>better not null default msg<commit_after>package jpaoletti.jpm.validator;

import jpaoletti.jpm.core.PMContext;
import jpaoletti.jpm.core.message.MessageFactory;

/**Validate that the specified field is not null
 * 
 * <h2>Simple entity configuration file</h2>
 * <pre>
 * {@code
 * <field>
 *     <id>some_id</id>
 *     ....
 *     <validator class="jpaoletti.jpm.validator.NotNull" />
 * </field>
 * }
 * </pre>
 * @author jpaoletti
 * */
public class NotNull extends ValidatorSupport {

    /**The validation method*/
    @Override
    public ValidationResult validate(PMContext ctx) {
        final ValidationResult res = new ValidationResult();
        final Object fieldvalue = ctx.getFieldValue();
        res.setSuccessful(fieldvalue != null);
        if (!res.isSuccessful()) {
            res.getMessages().add(MessageFactory.error(
                    ctx.getEntity(), ctx.getField(),
                    get("msg", "pm.validator.not.null"),
                    ctx.getField().getId()));
        }
        return res;
    }
}

{'fraction_non_alphanumeric': 0.13643031784841075, 'fraction_numerical': 0.0019559902200488996, 'mean_word_length': 2.5034246575342465, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1694350', 'n_tokens_mistral': 612, 'n_tokens_neox': 615, 'n_words': 128}