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, IS NODE KEY;
CREATE CONSTRAINT ON (entity:Entity) ASSERT exists(;

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.