24 lines
597 B
Java
24 lines
597 B
Java
package org.gcube.accounting.datamodel.validators;
|
|
|
|
import org.gcube.accounting.datamodel.UsageRecord;
|
|
import org.gcube.common.validator.annotations.FieldValidator;
|
|
|
|
public class UsageRecordTypeValidator implements FieldValidator<UsageRecordType>{
|
|
|
|
public Class<UsageRecordType> annotation() {
|
|
return UsageRecordType.class;
|
|
}
|
|
|
|
public boolean isValid(Object toValidate) {
|
|
if (toValidate.getClass().isInstance(UsageRecord.class)) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public String getErrorSuffix() {
|
|
return String.format("not instace of %s", UsageRecord.class.getSimpleName());
|
|
}
|
|
|
|
}
|