Skip to content

Commit

Permalink
Use standard ThrowingConsumer instead of custom interface
Browse files Browse the repository at this point in the history
  • Loading branch information
fickludd committed Mar 21, 2017
1 parent 3ab1b05 commit 35aae3a
Showing 1 changed file with 5 additions and 11 deletions.
Expand Up @@ -23,9 +23,9 @@

import org.neo4j.collection.primitive.Primitive;
import org.neo4j.collection.primitive.PrimitiveIntSet;
import org.neo4j.function.ThrowingConsumer;
import org.neo4j.kernel.api.schema_new.LabelSchemaDescriptor;
import org.neo4j.kernel.api.schema_new.LabelSchemaSupplier;
import org.neo4j.kernel.api.schema_new.SchemaDescriptor;
import org.neo4j.kernel.impl.api.KernelStatement;
import org.neo4j.kernel.impl.api.operations.EntityReadOperations;
import org.neo4j.storageengine.api.NodeItem;
Expand All @@ -43,7 +43,7 @@ public NodeSchemaMatcher( EntityReadOperations readOps )
}

/**
* Iterate over some schema suppliers, and invoke an action for every supplier that matches the node. To match the
* Iterate over some schema suppliers, and invoke a callback for every supplier that matches the node. To match the
* node N the supplier must supply a LabelSchemaDescriptor D, such that N has the label of D, and values for all
* the properties of D.
*
Expand All @@ -55,7 +55,7 @@ public NodeSchemaMatcher( EntityReadOperations readOps )
* @param node The node
* @param specialPropertyId This property id will always count as a match for the descriptor, regardless of
* whether the node has this property or not
* @param action The action to take on match
* @param callback The action to take on match
* @param <SUPPLIER> the type to match. Must implement LabelSchemaDescriptor.Supplier
* @param <EXCEPTION> The type of exception that can be thrown when taking the action
* @throws EXCEPTION This exception is propagated from the action
Expand All @@ -65,7 +65,7 @@ public <SUPPLIER extends LabelSchemaSupplier,EXCEPTION extends Exception> void o
Iterator<SUPPLIER> schemaSuppliers,
NodeItem node,
int specialPropertyId,
SchemaMatchAction<SUPPLIER, EXCEPTION> action
ThrowingConsumer<SUPPLIER, EXCEPTION> callback
) throws EXCEPTION
{
PrimitiveIntSet nodePropertyIds = null;
Expand All @@ -83,7 +83,7 @@ public <SUPPLIER extends LabelSchemaSupplier,EXCEPTION extends Exception> void o

if ( nodeHasSchemaProperties( nodePropertyIds, schema.getPropertyIds(), specialPropertyId ) )
{
action.act( schemaSupplier );
callback.accept( schemaSupplier );
}
}
}
Expand All @@ -101,10 +101,4 @@ public static boolean nodeHasSchemaProperties(
}
return true;
}

public interface SchemaMatchAction<SUPPLIER extends SchemaDescriptor.Supplier, EXCEPTION extends Exception>
{
void act( SUPPLIER schemaSupplier ) throws EXCEPTION;
}

}

0 comments on commit 35aae3a

Please sign in to comment.