Package org.neo4j.graphdb.schema
Interface ConstraintDefinition
public interface ConstraintDefinition
Definition of a constraint.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
drop()
Drops this constraint.getLabel()
This accessor method returns a label which this constraint is associated with if this constraint has typeConstraintType.UNIQUENESS
,ConstraintType.NODE_PROPERTY_EXISTENCE
, orConstraintType.NODE_KEY
.getName()
Get the name given to this constraint when it was created.This accessor method returns thePropertyType
(s) this constraint is associated with if this constraint has typeConstraintType.NODE_PROPERTY_TYPE
orConstraintType.RELATIONSHIP_PROPERTY_TYPE
.This accessor method returns a relationship type which this constraint is associated with if this constraint has typeConstraintType.RELATIONSHIP_UNIQUENESS
,ConstraintType.RELATIONSHIP_PROPERTY_EXISTENCE
, orConstraintType.RELATIONSHIP_KEY
.boolean
-
Method Details
-
getLabel
Label getLabel()This accessor method returns a label which this constraint is associated with if this constraint has typeConstraintType.UNIQUENESS
,ConstraintType.NODE_PROPERTY_EXISTENCE
, orConstraintType.NODE_KEY
. Type of the constraint can be examined by callinggetConstraintType()
orisConstraintType(ConstraintType)
methods.- Returns:
- the
Label
this constraint is associated with. - Throws:
IllegalStateException
- when this constraint is associated with relationships.
-
getRelationshipType
RelationshipType getRelationshipType()This accessor method returns a relationship type which this constraint is associated with if this constraint has typeConstraintType.RELATIONSHIP_UNIQUENESS
,ConstraintType.RELATIONSHIP_PROPERTY_EXISTENCE
, orConstraintType.RELATIONSHIP_KEY
. Type of the constraint can be examined by callinggetConstraintType()
orisConstraintType(ConstraintType)
methods.- Returns:
- the
RelationshipType
this constraint is associated with. - Throws:
IllegalStateException
- when this constraint is associated with nodes.
-
getPropertyKeys
- Returns:
- the property keys this constraint is about.
-
drop
void drop()Drops this constraint. -
getConstraintType
ConstraintType getConstraintType()- Returns:
- the
ConstraintType
of constraint.
-
isConstraintType
- Parameters:
type
- a constraint type- Returns:
- true if this constraint definition's type is equal to the provided type
-
getName
String getName()Get the name given to this constraint when it was created. Constraints that were not explicitly given a name at creation, will have an auto-generated name.- Returns:
- the unique name of the constraint.
-
getPropertyType
PropertyType[] getPropertyType()This accessor method returns thePropertyType
(s) this constraint is associated with if this constraint has typeConstraintType.NODE_PROPERTY_TYPE
orConstraintType.RELATIONSHIP_PROPERTY_TYPE
. Type of the constraint can be examined by callinggetConstraintType()
orisConstraintType(ConstraintType)
methods.- Returns:
- the
PropertyType
s this constraint is associated with. - Throws:
IllegalStateException
- when this constraint is not of an applicable type.
-