package org.gcube.accounting.datamodel.validators; import java.io.Serializable; import org.gcube.accounting.datamodel.annotations.ValidLong; public class ValidIntegerValidator implements FieldValidator{ public Class annotation() { return ValidLong.class; } public boolean isValid(Serializable toValidate) { if(toValidate instanceof Integer){ return true; } Integer integerObj = Integer.getInteger((String) toValidate); if(integerObj!=null){ return true; } return false; } public String getErrorSuffix() { return String.format("not instace of %s", Integer.class.getSimpleName()); } }