use of org.neo4j.kernel.api.constraints.NodePropertyConstraint in project neo4j by neo4j.
the class AlreadyConstrainedException method constructUserMessage.
private static String constructUserMessage(OperationContext context, TokenNameLookup tokenNameLookup, PropertyConstraint constraint) {
switch(context) {
case INDEX_CREATION:
// is is safe to cast here because we only support indexes on nodes atm
NodePropertyConstraint nodePropertyConstraint = (NodePropertyConstraint) constraint;
NodePropertyDescriptor descriptor = nodePropertyConstraint.descriptor();
return messageWithLabelAndPropertyName(tokenNameLookup, INDEX_CONTEXT_FORMAT, descriptor);
case CONSTRAINT_CREATION:
return ALREADY_CONSTRAINED_MESSAGE_PREFIX + constraint.userDescription(tokenNameLookup);
default:
return format(NO_CONTEXT_FORMAT, constraint);
}
}
Aggregations