All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.higgs.http.server.params.DefaultValidator Maven / Gradle / Ivy

There is a newer version: 0.0.24
Show newest version
package io.higgs.http.server.params;

import io.higgs.http.server.MethodParam;

/**
 * @author Courtney Robinson 
 */
public class DefaultValidator implements Validator {
    @Override
    public boolean isValid(Object value) {
        //value must not be null, and if value is a string it cannot be empty
        return value != null && (!(value instanceof String) || !((String) value).isEmpty());
    }

    @Override
    public String getValidationMessage(MethodParam param) {
        return String.format("%s is required", param.getName());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy