-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
IndexCreator.java
65 lines (61 loc) · 2.54 KB
/
IndexCreator.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* Copyright (c) 2002-2018 "Neo4j,"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.graphdb.schema;
import org.neo4j.graphdb.ConstraintViolationException;
import org.neo4j.graphdb.Label;
import org.neo4j.graphdb.Node;
/**
* A builder for entering details about an index to create. After all details have been entered
* {@link #create()} must be called for the index to actually be created. An index creator knows
* which {@link Label label} it is to be created for.
* <p>
* All methods except {@link #create()} will return an {@link IndexCreator} which should be
* used for further interaction.
*
* @see Schema
*/
public interface IndexCreator
{
/**
* Includes the given {@code propertyKey} in this index, such that {@link Node nodes} with
* the assigned {@link Label label} and this property key will have its values indexed.
* <p>
* NOTE: currently only a single property key per index is supported.
*
* @param propertyKey the property key to include in this index to be created.
* @return an {@link IndexCreator} instance to be used for further interaction.
*/
IndexCreator on( String propertyKey );
/**
* Assign a name to the index, which will then be returned from {@link IndexDefinition#getName()}, and can be used for finding the index with
* {@link Schema#getIndexByName(String)}.
*
* @param indexName the name to give the index.
* @return an {@link IndexCreator} instance to be used for further interaction.
*/
IndexCreator withName( String indexName );
/**
* Creates an index with the details specified by the other methods in this interface.
*
* @return the created {@link IndexDefinition index}.
* @throws ConstraintViolationException if creating this index would violate one or more constraints.
*/
IndexDefinition create() throws ConstraintViolationException;
}