Class BaseIncludeRelationships<T extends BaseIncludeRelationships<T>>
- java.lang.Object
-
- com.graphaware.common.policy.inclusion.BaseEntityInclusionPolicy<T>
-
- com.graphaware.common.policy.inclusion.fluent.IncludeEntities<T,Relationship>
-
- com.graphaware.common.policy.inclusion.fluent.BaseIncludeRelationships<T>
-
- All Implemented Interfaces:
EntityInclusionPolicy<Relationship>
,InclusionPolicy
,ObjectInclusionPolicy<Relationship>
,RelationshipInclusionPolicy
- Direct Known Subclasses:
IncludeRelationships
public abstract class BaseIncludeRelationships<T extends BaseIncludeRelationships<T>> extends IncludeEntities<T,Relationship> implements RelationshipInclusionPolicy
Abstract base class forRelationshipInclusionPolicy
implementations with fluent interface, intended to be used programmatically.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.graphaware.common.policy.inclusion.RelationshipInclusionPolicy
RelationshipInclusionPolicy.Adapter
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseIncludeRelationships(Direction direction, String[] relationshipTypes, DetachedPropertiesDescription propertiesDescription)
Create a new policy.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
Direction
getDirection()
Get the direction with which this policy has been configured.String[]
getRelationshipTypes()
Get the relationship types with which this policy has been configured.int
hashCode()
boolean
include(Relationship relationship)
Include the given object?boolean
include(Relationship relationship, Node pointOfView)
Include the given relationships from the given node's point of view?protected abstract T
newInstance(Direction direction, String... relationshipTypes)
Create a new instance of this policy with the given direction and relationship types.T
with(String... relationshipTypes)
Create a new policy from the current one, reconfigured to only match relationships with the given relationship types.T
with(Direction direction)
Create a new policy from the current one, reconfigured to only match relationships with the given direction.T
with(Direction direction, String... relationshipTypes)
Create a new policy from the current one, reconfigured to only match relationships with the given direction and relationship types.T
with(Direction direction, RelationshipType... relationshipTypes)
Create a new policy from the current one, reconfigured to only match relationships with the given direction and relationship types.T
with(RelationshipType... relationshipTypes)
Create a new policy from the current one, reconfigured to only match relationships with the given relationship types.-
Methods inherited from class com.graphaware.common.policy.inclusion.fluent.IncludeEntities
getPropertiesDescription, newInstance, with
-
Methods inherited from class com.graphaware.common.policy.inclusion.BaseEntityInclusionPolicy
doGetAll, getAll
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.graphaware.common.policy.inclusion.EntityInclusionPolicy
getAll
-
-
-
-
Constructor Detail
-
BaseIncludeRelationships
protected BaseIncludeRelationships(Direction direction, String[] relationshipTypes, DetachedPropertiesDescription propertiesDescription)
Create a new policy.- Parameters:
direction
- that matching relationships must have,Direction.BOTH
for both.relationshipTypes
- one of which the matching relationships must have, empty for all.propertiesDescription
- of the matching relationships.
-
-
Method Detail
-
with
public T with(String... relationshipTypes)
Create a new policy from the current one, reconfigured to only match relationships with the given relationship types.- Parameters:
relationshipTypes
- one of which the matching relationships must have, empty for all.- Returns:
- reconfigured policy.
-
with
public T with(RelationshipType... relationshipTypes)
Create a new policy from the current one, reconfigured to only match relationships with the given relationship types.- Parameters:
relationshipTypes
- one of which the matching relationships must have, empty for all.- Returns:
- reconfigured policy.
-
with
public T with(Direction direction)
Create a new policy from the current one, reconfigured to only match relationships with the given direction.- Parameters:
direction
- that matching relationships must have,Direction.BOTH
for both.- Returns:
- reconfigured policy.
-
with
public T with(Direction direction, RelationshipType... relationshipTypes)
Create a new policy from the current one, reconfigured to only match relationships with the given direction and relationship types.- Parameters:
direction
- that matching relationships must have,Direction.BOTH
for both.relationshipTypes
- one of which the matching relationships must have, empty for all.- Returns:
- reconfigured policy.
-
with
public T with(Direction direction, String... relationshipTypes)
Create a new policy from the current one, reconfigured to only match relationships with the given direction and relationship types.- Parameters:
direction
- that matching relationships must have,Direction.BOTH
for both.relationshipTypes
- one of which the matching relationships must have, empty for all.- Returns:
- reconfigured policy.
-
newInstance
protected abstract T newInstance(Direction direction, String... relationshipTypes)
Create a new instance of this policy with the given direction and relationship types.- Parameters:
direction
- of the new policy.relationshipTypes
- of the new policy.- Returns:
- new policy.
-
include
public boolean include(Relationship relationship)
Description copied from interface:ObjectInclusionPolicy
Include the given object?- Specified by:
include
in interfaceObjectInclusionPolicy<T extends BaseIncludeRelationships<T>>
- Overrides:
include
in classIncludeEntities<T extends BaseIncludeRelationships<T>,Relationship>
- Parameters:
relationship
- to check.- Returns:
- true iff the given object should be included.
-
include
public boolean include(Relationship relationship, Node pointOfView)
Description copied from interface:RelationshipInclusionPolicy
Include the given relationships from the given node's point of view?- Specified by:
include
in interfaceRelationshipInclusionPolicy
- Parameters:
relationship
- to make a decision on.pointOfView
- node looking at the relationship. Must be one of the relationship's nodes.- Returns:
- true to include, false to exclude.
-
getDirection
public Direction getDirection()
Get the direction with which this policy has been configured.- Returns:
- direction, never null.
-
getRelationshipTypes
public String[] getRelationshipTypes()
Get the relationship types with which this policy has been configured.- Returns:
- types, never null.
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classIncludeEntities<T extends BaseIncludeRelationships<T>,Relationship>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classIncludeEntities<T extends BaseIncludeRelationships<T>,Relationship>
-
-