Search in sources :

Example 1 with ConstraintType

use of org.neo4j.graphdb.schema.ConstraintType in project neo4j by neo4j.

the class ConstraintDefinitionRepresentation method serialize.

@Override
protected void serialize(MappingSerializer serializer) {
    switch(constraintDefinition.getConstraintType()) {
        case UNIQUENESS:
        case NODE_PROPERTY_EXISTENCE:
            serializer.putString("label", constraintDefinition.getLabel().name());
            break;
        case RELATIONSHIP_PROPERTY_EXISTENCE:
            serializer.putString("relationshipType", constraintDefinition.getRelationshipType().name());
            break;
        default:
            throw new IllegalStateException("Unknown constraint type:" + constraintDefinition.getConstraintType());
    }
    ConstraintType type = constraintDefinition.getConstraintType();
    serializer.putString("type", type.name());
    serialize(constraintDefinition, serializer);
}
Also used : ConstraintType(org.neo4j.graphdb.schema.ConstraintType)

Aggregations

ConstraintType (org.neo4j.graphdb.schema.ConstraintType)1