59 lines
1.5 KiB
Java
59 lines
1.5 KiB
Java
package eu.dnetlib.validator2.validation.guideline;
|
|
|
|
import eu.dnetlib.validator2.engine.Status;
|
|
|
|
import java.io.Serializable;
|
|
|
|
public interface Guideline<T> {
|
|
|
|
String getName();
|
|
|
|
String getDescription();
|
|
|
|
String getLink();
|
|
|
|
String getFairPrinciples();
|
|
|
|
int getWeight(); //that's the "score" of the guideline if it succeeds
|
|
|
|
RequirementLevel getRequirementLevel();
|
|
|
|
default Result validate(T t) {
|
|
return validate(t == null ? "Object" : t.getClass().getSimpleName(), t);
|
|
}
|
|
|
|
Result validate(String id, T t);
|
|
|
|
interface Result extends Serializable {
|
|
|
|
int score();
|
|
|
|
Status status();
|
|
|
|
// When status == SUCCESS, potential warnings are held here
|
|
// This may also contain messages when status == FAILURE
|
|
Iterable<String> warnings();
|
|
|
|
// When status == FAILURE, the errors are held here
|
|
// We currently hold a single error (and fail fast)
|
|
Iterable<String> errors();
|
|
|
|
// When status == ERROR, the internal error is held here
|
|
String internalError();
|
|
|
|
|
|
// Follow the bean conventions.
|
|
int getScore();
|
|
void setScore(int score);
|
|
Status getStatus();
|
|
void setStatus(Status status);
|
|
Iterable<String> getWarnings();
|
|
void setWarnings(Iterable<String> warnings);
|
|
Iterable<String> getErrors();
|
|
void setErrors(Iterable<String> errors);
|
|
String getInternalError();
|
|
void setInternalError(String internalError);
|
|
}
|
|
|
|
}
|