How can I create constraints using Java API?

How do I create the following constraints with the Java APIs?
CREATE CONSTRAINT ON (entity:Entity) ASSERT(entity.prefix, entity.name) IS NODE KEY;
CREATE CONSTRAINT ON (entity:Entity) ASSERT exists(entity.name);

I am looking at ConstraintCreator API documentation and cannot figure it out

Just run Cypher using the Java API - there shouldn't be a need to use ConstraintCreator at all.

https://neo4j.com/docs/java-reference/current/tutorials-java-embedded/cypher-java/