diff --git a/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/constaints/ConstraintDescriptor.java b/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/constaints/ConstraintDescriptor.java
index 580237714dc39..cda2cf4bee66c 100644
--- a/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/constaints/ConstraintDescriptor.java
+++ b/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/constaints/ConstraintDescriptor.java
@@ -22,36 +22,76 @@
import org.neo4j.kernel.api.TokenNameLookup;
import org.neo4j.kernel.api.schema_new.SchemaDescriptor;
+import static java.lang.String.format;
+
/**
* Internal representation of a graph constraint, including the schema unit it targets (eg. label-property combination)
* and the how that schema unit is constrained (eg. "has to exist", or "must be unique").
*/
-public interface ConstraintDescriptor
+public class ConstraintDescriptor
{
- enum Type { UNIQUE, EXISTS }
+ public enum Type { UNIQUE, EXISTS }
+
+ public interface Supplier
+ {
+ ConstraintDescriptor getConstraintDescriptor();
+ }
- SchemaDescriptor schema();
+ private final SchemaDescriptor schema;
+ private final ConstraintDescriptor.Type type;
- Type type();
+ ConstraintDescriptor( SchemaDescriptor schema, Type type )
+ {
+ this.schema = schema;
+ this.type = type;
+ }
+
+ // METHODS
+
+ public SchemaDescriptor schema()
+ {
+ return schema;
+ }
+
+ public Type type()
+ {
+ return type;
+ }
/**
* @param tokenNameLookup used for looking up names for token ids.
* @return a user friendly description of what this index indexes.
*/
- String userDescription( TokenNameLookup tokenNameLookup );
+
+ public String userDescription( TokenNameLookup tokenNameLookup )
+ {
+ return format( "Constraint( %s, %s )", type.name(), schema.userDescription( tokenNameLookup ) );
+ }
/**
* Checks whether a constraint descriptor Supplier supplies this constraint descriptor.
* @param supplier supplier to get a constraint descriptor from
* @return true if the supplied constraint descriptor equals this constraint descriptor
*/
- default boolean isSame( Supplier supplier )
+ public boolean isSame( Supplier supplier )
{
return this.equals( supplier.getConstraintDescriptor() );
}
- interface Supplier
+ @Override
+ public boolean equals( Object o )
{
- ConstraintDescriptor getConstraintDescriptor();
+ if ( o != null && o instanceof ConstraintDescriptor )
+ {
+ ConstraintDescriptor that = (ConstraintDescriptor)o;
+ return this.type() == that.type() && this.schema().equals( that.schema() );
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return type.hashCode() & schema.hashCode();
}
}
diff --git a/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/constaints/ConstraintDescriptorFactory.java b/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/constaints/ConstraintDescriptorFactory.java
index a4ab3ba2bb1ad..92c6120e27fc0 100644
--- a/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/constaints/ConstraintDescriptorFactory.java
+++ b/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/constaints/ConstraintDescriptorFactory.java
@@ -28,21 +28,21 @@ public class ConstraintDescriptorFactory
{
public static ConstraintDescriptor existsForLabel( int labelId, int... propertyIds )
{
- return new ConstraintDescriptorImpl( SchemaDescriptorFactory.forLabel( labelId, propertyIds ), EXISTS );
+ return new ConstraintDescriptor( SchemaDescriptorFactory.forLabel( labelId, propertyIds ), EXISTS );
}
public static ConstraintDescriptor existsForRelType( int relTypeId, int... propertyIds )
{
- return new ConstraintDescriptorImpl( SchemaDescriptorFactory.forRelType( relTypeId, propertyIds ), EXISTS );
+ return new ConstraintDescriptor( SchemaDescriptorFactory.forRelType( relTypeId, propertyIds ), EXISTS );
}
public static ConstraintDescriptor uniqueForLabel( int labelId, int... propertyIds )
{
- return new ConstraintDescriptorImpl( SchemaDescriptorFactory.forLabel( labelId, propertyIds ), UNIQUE );
+ return new ConstraintDescriptor( SchemaDescriptorFactory.forLabel( labelId, propertyIds ), UNIQUE );
}
public static ConstraintDescriptor uniqueForRelType( int relTypeId, int... propertyIds )
{
- return new ConstraintDescriptorImpl( SchemaDescriptorFactory.forRelType( relTypeId, propertyIds ), UNIQUE );
+ return new ConstraintDescriptor( SchemaDescriptorFactory.forRelType( relTypeId, propertyIds ), UNIQUE );
}
}
diff --git a/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/constaints/ConstraintDescriptorImpl.java b/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/constaints/ConstraintDescriptorImpl.java
deleted file mode 100644
index a6647cfa3aa35..0000000000000
--- a/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/constaints/ConstraintDescriptorImpl.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2002-2017 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.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 .
- */
-package org.neo4j.kernel.api.schema_new.constaints;
-
-import org.neo4j.kernel.api.TokenNameLookup;
-import org.neo4j.kernel.api.schema_new.SchemaDescriptor;
-
-import static java.lang.String.format;
-
-class ConstraintDescriptorImpl implements ConstraintDescriptor
-{
- private final SchemaDescriptor schema;
- private final ConstraintDescriptor.Type type;
-
- ConstraintDescriptorImpl( SchemaDescriptor schema, Type type )
- {
- this.schema = schema;
- this.type = type;
- }
-
- @Override
- public SchemaDescriptor schema()
- {
- return schema;
- }
-
- @Override
- public Type type()
- {
- return type;
- }
-
- @Override
- public String userDescription( TokenNameLookup tokenNameLookup )
- {
- return format( "Constraint( %s, %s )", type.name(), schema.userDescription( tokenNameLookup ) );
- }
-
- @Override
- public boolean equals( Object o )
- {
- if ( o != null && o instanceof ConstraintDescriptor )
- {
- ConstraintDescriptor that = (ConstraintDescriptor)o;
- return this.type() == that.type() && this.schema().equals( that.schema() );
- }
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return type.hashCode() & schema.hashCode();
- }
-}
diff --git a/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/index/NewIndexDescriptor.java b/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/index/NewIndexDescriptor.java
index cbe06c154486f..86477e550124b 100644
--- a/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/index/NewIndexDescriptor.java
+++ b/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/index/NewIndexDescriptor.java
@@ -22,40 +22,82 @@
import org.neo4j.kernel.api.TokenNameLookup;
import org.neo4j.kernel.api.schema_new.LabelSchemaDescriptor;
+import static java.lang.String.format;
+
/**
* Internal representation of a graph index, including the schema unit it targets (eg. label-property combination)
* and the type of index. UNIQUE indexes are used to back uniqueness constraints.
+ *
+ * This will be renamed to IndexDescriptor, once the old org.neo4j.kernel.api.schema.IndexDescriptor is completely
+ * removed.
*/
-public interface NewIndexDescriptor
+public class NewIndexDescriptor
{
- enum Type { GENERAL, UNIQUE }
+ public enum Type { GENERAL, UNIQUE }
+
+ public interface Supplier
+ {
+ NewIndexDescriptor getNewIndexDescriptor();
+ }
- Type type();
+ private final LabelSchemaDescriptor schema;
+ private final NewIndexDescriptor.Type type;
+
+ NewIndexDescriptor( LabelSchemaDescriptor schema, Type type )
+ {
+ this.schema = schema;
+ this.type = type;
+ }
+
+ // METHODS
+
+ public Type type()
+ {
+ return type;
+ }
/**
* This method currently returns the specific LabelSchemaDescriptor, as we do not support indexes on relations.
* When we do, consider down-typing this to a SchemaDescriptor.
*/
- LabelSchemaDescriptor schema();
+ public LabelSchemaDescriptor schema()
+ {
+ return schema;
+ }
/**
* @param tokenNameLookup used for looking up names for token ids.
* @return a user friendly description of what this index indexes.
*/
- String userDescription( TokenNameLookup tokenNameLookup );
+ public String userDescription( TokenNameLookup tokenNameLookup )
+ {
+ return format( "Index( %s, %s )", type.name(), schema.userDescription( tokenNameLookup ) );
+ }
/**
- * Checks whether a constraint descriptor Supplier supplies this constraint descriptor.
- * @param supplier supplier to get a constraint descriptor from
- * @return true if the supplied constraint descriptor equals this constraint descriptor
+ * Checks whether an index descriptor Supplier supplies this index descriptor.
+ * @param supplier supplier to get a index descriptor from
+ * @return true if the supplied index descriptor equals this index descriptor
*/
- default boolean isSame( Supplier supplier )
+ public boolean isSame( Supplier supplier )
{
return this.equals( supplier.getNewIndexDescriptor() );
}
- interface Supplier
+ @Override
+ public boolean equals( Object o )
{
- NewIndexDescriptor getNewIndexDescriptor();
+ if ( o != null && o instanceof NewIndexDescriptor )
+ {
+ NewIndexDescriptor that = (NewIndexDescriptor)o;
+ return this.type() == that.type() && this.schema().equals( that.schema() );
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return type.hashCode() & schema.hashCode();
}
}
diff --git a/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/index/NewIndexDescriptorFactory.java b/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/index/NewIndexDescriptorFactory.java
index 56bcadcfa5d46..a389bb357fe0d 100644
--- a/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/index/NewIndexDescriptorFactory.java
+++ b/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/index/NewIndexDescriptorFactory.java
@@ -28,11 +28,11 @@ public class NewIndexDescriptorFactory
{
public static NewIndexDescriptor forLabel( int labelId, int... propertyIds )
{
- return new NewIndexDescriptorImpl( SchemaDescriptorFactory.forLabel( labelId, propertyIds ), GENERAL );
+ return new NewIndexDescriptor( SchemaDescriptorFactory.forLabel( labelId, propertyIds ), GENERAL );
}
public static NewIndexDescriptor uniqueForLabel( int labelId, int... propertyIds )
{
- return new NewIndexDescriptorImpl( SchemaDescriptorFactory.forLabel( labelId, propertyIds ), UNIQUE );
+ return new NewIndexDescriptor( SchemaDescriptorFactory.forLabel( labelId, propertyIds ), UNIQUE );
}
}
diff --git a/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/index/NewIndexDescriptorImpl.java b/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/index/NewIndexDescriptorImpl.java
deleted file mode 100644
index f91122202e66e..0000000000000
--- a/community/kernel/src/main/java/org/neo4j/kernel/api/schema_new/index/NewIndexDescriptorImpl.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2002-2017 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.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 .
- */
-package org.neo4j.kernel.api.schema_new.index;
-
-import org.neo4j.kernel.api.TokenNameLookup;
-import org.neo4j.kernel.api.schema_new.LabelSchemaDescriptor;
-
-import static java.lang.String.format;
-
-class NewIndexDescriptorImpl implements NewIndexDescriptor
-{
- private final LabelSchemaDescriptor schema;
- private final NewIndexDescriptor.Type type;
-
- NewIndexDescriptorImpl( LabelSchemaDescriptor schema, Type type )
- {
- this.schema = schema;
- this.type = type;
- }
-
- @Override
- public Type type()
- {
- return type;
- }
-
- @Override
- public LabelSchemaDescriptor schema()
- {
- return schema;
- }
-
- @Override
- public String userDescription( TokenNameLookup tokenNameLookup )
- {
- return format( "Index( %s, %s )", type.name(), schema.userDescription( tokenNameLookup ) );
- }
-
- @Override
- public boolean equals( Object o )
- {
- if ( o != null && o instanceof NewIndexDescriptor )
- {
- NewIndexDescriptor that = (NewIndexDescriptor)o;
- return this.type() == that.type() && this.schema().equals( that.schema() );
- }
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return type.hashCode() & schema.hashCode();
- }
-}
diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/storemigration/legacystore/v21/propertydeduplication/IndexLookup.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/storemigration/legacystore/v21/propertydeduplication/IndexLookup.java
index 96c179d19afc6..c85853affb105 100644
--- a/community/kernel/src/main/java/org/neo4j/kernel/impl/storemigration/legacystore/v21/propertydeduplication/IndexLookup.java
+++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/storemigration/legacystore/v21/propertydeduplication/IndexLookup.java
@@ -19,8 +19,6 @@
*/
package org.neo4j.kernel.impl.storemigration.legacystore.v21.propertydeduplication;
-import sun.reflect.generics.reflectiveObjects.NotImplementedException;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;