org.optaplanner.quarkus.jackson.it.solver.ITestdataPlanningConstraintProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of optaplanner-quarkus-jackson-integration-test Show documentation
Show all versions of optaplanner-quarkus-jackson-integration-test Show documentation
Quarkus integration tests for OptaPlanner with Jackson
package org.optaplanner.quarkus.jackson.it.solver;
import org.optaplanner.core.api.score.buildin.simple.SimpleScore;
import org.optaplanner.core.api.score.stream.Constraint;
import org.optaplanner.core.api.score.stream.ConstraintFactory;
import org.optaplanner.core.api.score.stream.ConstraintProvider;
import org.optaplanner.core.api.score.stream.Joiners;
import org.optaplanner.quarkus.jackson.it.domain.ITestdataPlanningEntity;
public class ITestdataPlanningConstraintProvider implements ConstraintProvider {
@Override
public Constraint[] defineConstraints(ConstraintFactory factory) {
return new Constraint[] {
factory.forEach(ITestdataPlanningEntity.class)
.join(ITestdataPlanningEntity.class, Joiners.equal(ITestdataPlanningEntity::getValue))
.filter((a, b) -> a != b)
.penalize(SimpleScore.ONE)
.asConstraint("Don't assign 2 entities the same value.")
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy