Package org.neo4j.graphdb
Class PathExpanderBuilder
java.lang.Object
org.neo4j.graphdb.PathExpanderBuilder
A fluent builder for creating specialized
path expanders
.
See PathExpanders
for a catalog of common expanders.
-
Method Summary
Modifier and TypeMethodDescriptionadd
(RelationshipType type) Add a pair oftype
andDirection.BOTH
to the PathExpander configuration.add
(RelationshipType type, Direction direction) Add a pair oftype
anddirection
to the PathExpander configuration.addNodeFilter
(Predicate<? super Node> filter) Adds aNode
filter.addRelationshipFilter
(Predicate<? super Relationship> filter) Adds aRelationship
filter.static PathExpanderBuilder
APathExpanderBuilder
seeded with all possible types but restricted todirection
.static PathExpanderBuilder
APathExpanderBuilder
that is seeded with all possible relationship types inboth directions
.<STATE> PathExpander<STATE>
build()
Produce aPathExpander
from the configuration you have built up.static PathExpanderBuilder
empty()
APathExpanderBuilder
that follows no relationships.static PathExpanderBuilder
APathExpanderBuilder
that follows no relationships.remove
(RelationshipType type) Remove expansion oftype
in any direction from the PathExpander configuration.
-
Method Details
-
empty
APathExpanderBuilder
that follows no relationships. You start with this and useadd(RelationshipType, Direction)
to form a restrictive PathExpander with just a few expansion rules in it.- Returns:
- a
PathExpanderBuilder
that follows no relationships
-
emptyOrderedByType
APathExpanderBuilder
that follows no relationships. You start with this and useadd(RelationshipType, Direction)
to form a restrictive PathExpander with just a few expansion rules in it.- Returns:
- a
PathExpanderBuilder
that follows no relationships
-
allTypesAndDirections
APathExpanderBuilder
that is seeded with all possible relationship types inboth directions
. You start with this andremove types
to form a permissivePathExpander
with just a few exceptions in it.- Returns:
- a
PathExpanderBuilder
that is seeded with all possible relationship types inboth directions
-
allTypes
APathExpanderBuilder
seeded with all possible types but restricted todirection
. You start with this andremove types
to form a permissivePathExpander
with just a few exceptions in it.- Parameters:
direction
- The direction you want to restrict expansions to- Returns:
- a
PathExpanderBuilder
seeded with all possible types but restricted todirection
.
-
add
Add a pair oftype
andDirection.BOTH
to the PathExpander configuration.- Parameters:
type
- the type to add for expansion in both directions- Returns:
- a
PathExpanderBuilder
with the added expansion oftype
relationships in both directions
-
add
Add a pair oftype
anddirection
to the PathExpander configuration.- Parameters:
type
- the type to add for expansiondirection
- the direction to restrict the expansion to- Returns:
- a
PathExpanderBuilder
with the added expansion oftype
relationships in the given direction
-
remove
Remove expansion oftype
in any direction from the PathExpander configuration.Example:
PathExpanderBuilder.allTypesAndDirections().remove(type).add(type, Direction.INCOMING)
would restrict thePathExpander
to only followDirection.INCOMING
relationships fortype
while following any other relationship type in either direction.- Parameters:
type
- the type to remove from expansion- Returns:
- a
PathExpanderBuilder
with expansion oftype
relationships removed
-
addNodeFilter
Adds aNode
filter.- Parameters:
filter
- a Predicate for filtering nodes.- Returns:
- a
PathExpanderBuilder
with the added node filter.
-
addRelationshipFilter
Adds aRelationship
filter.- Parameters:
filter
- a Predicate for filtering relationships.- Returns:
- a
PathExpanderBuilder
with the added relationship filter.
-
build
Produce aPathExpander
from the configuration you have built up.- Type Parameters:
STATE
- the type of the object holding the state- Returns:
- a PathExpander produced from the configuration you have built up
-