Class Index
java.lang.Object
ac.simons.neo4j.migrations.core.catalog.Index
- All Implemented Interfaces:
CatalogItem<Index.Type>
,Formattable
A somewhat Neo4j version independent representation of an index.
- Since:
- 1.7.0
- Author:
- Michael J. Simons, Gerrit Meier
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Programmatic way of defining indexes.static interface
A fulltext builder, the only index allowing multiple types when being created.static interface
Marker for the step after an index has been given a name.static interface
Fulltext is the only index available for multiple labels and multiple types in on go.static interface
Allows to specify the type of the constraint.static enum
Enumerates the different kinds of indexes. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
final void
static Index.Builder
Starts defining a new instance of a node index.static Index.FulltextBuilder
Starts defining a new instance of a node index.static Index.Builder
forRelationship
(String type) Starts defining a new instance of a node index.static Index.FulltextBuilder
forRelationship
(String... types) Starts defining a new instance of a relationship index.getName()
getType()
boolean
int
hashCode()
boolean
isEquivalentTo
(CatalogItem<?> that) true, if item is an index of the same type for the same entity containing the same properties.static Index
parse
(org.neo4j.driver.types.MapAccessor row) Parses an index from aMapAccessor
static Index
Creates an index from a xml definition.toString()
Creates a copy of this item with the specific name.withOptions
(String newOptions) Creates a copy of this index with the specific set of options added.withType
(Index.Type newType) Creates a copy of this index with the given type.
-
Field Details
-
options
Any additional options to be passed to the item. Might be null.
-
-
Method Details
-
forNode
Starts defining a new instance of a node index.- Parameters:
label
- The label on which the index should be applied- Returns:
- The ongoing builder
-
forNode
Starts defining a new instance of a node index.- Parameters:
labels
- The labels on which the index should be applied- Returns:
- The ongoing builder
-
forRelationship
Starts defining a new instance of a node index.- Parameters:
type
- The type on which the index should be applied- Returns:
- The ongoing builder
-
forRelationship
Starts defining a new instance of a relationship index.- Parameters:
types
- The type on which the index should be applied- Returns:
- The ongoing builder
-
parse
Creates an index from a xml definition.- Parameters:
indexElement
- as defined inmigration.xsd
.- Returns:
- The new index if the element as parseable
-
parse
Parses an index from aMapAccessor
- Parameters:
row
- the result row- Returns:
- An index
- Throws:
IllegalArgumentException
- if the row cannot be processed
-
toString
-
withName
Description copied from interface:CatalogItem
Creates a copy of this item with the specific name. Will return this instance if the name has not changed.- Parameters:
newName
- The new name to use- Returns:
- A (potentially) new item
-
withOptions
Creates a copy of this index with the specific set of options added. Will return this instance if the options are identical to current options.- Parameters:
newOptions
- The new options to use- Returns:
- A (potentially) new index
- Since:
- 1.13.0
-
withType
Creates a copy of this index with the given type. Will return this instance if the type is identical to the current one.- Parameters:
newType
- The new type to use- Returns:
- A (potentially) new index
- Since:
- 1.13.0
-
isEquivalentTo
true, if item is an index of the same type for the same entity containing the same properties. Also index name and options will be compared.- Parameters:
that
- the other item to compare to- Returns:
- true if this and the other item are equivalent
-
getName
- Specified by:
getName
in interfaceCatalogItem<T extends ItemType>
- Returns:
- A unique name for a catalog item.
-
getType
- Specified by:
getType
in interfaceCatalogItem<T extends ItemType>
- Returns:
- Type information for the given item, specialized to the item type itself.
-
getTargetEntityType
- Returns:
- The target entity of this item.
-
getIdentifier
- Returns:
- Identifier of this item to be used in create statements
-
getProperties
- Returns:
- Set of properties to be included with the item
-
getOptionalOptions
- Returns:
- Optional options to be passed down during creation of the item
-
hasGeneratedName
public boolean hasGeneratedName()- Specified by:
hasGeneratedName
in interfaceCatalogItem<T extends ItemType>
- Returns:
- true if this item has a generated name.
-
formatTo
- Specified by:
formatTo
in interfaceFormattable
-
equals
-
hashCode
public int hashCode()
-