Package org.neo4j.cypherdsl.core
Class NodeBase<SELF extends Node>
- java.lang.Object
-
- org.neo4j.cypherdsl.core.NodeBase<SELF>
-
- Type Parameters:
SELF
- The type of this node
- All Implemented Interfaces:
ExposesProperties<Node>
,ExposesRelationships<Relationship>
,Named
,Node
,PatternElement
,PropertyContainer
,Visitable
@API(status=EXPERIMENTAL, since="2021.1.0") public abstract class NodeBase<SELF extends Node> extends java.lang.Object implements Node
This is the base class for all nodes. It can be used with generics, specifying a valid type. This is useful when using it as a base class for a static meta model.- Since:
- 2021.1.0
- Author:
- Michael J. Simons
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
NodeBase(java.lang.String primaryLabel, java.lang.String... additionalLabels)
protected
NodeBase(SymbolicName symbolicName, java.util.List<NodeLabel> labels, Properties properties)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
accept(Visitor visitor)
AliasedExpression
as(java.lang.String alias)
Creates an alias for this node.SortItem
ascending()
Creates a new sort item of this node in ascending order.SortItem
descending()
Creates a new sort item of this node in descending order.java.util.List<NodeLabel>
getLabels()
protected Properties
getProperties()
SymbolicName
getRequiredSymbolicName()
java.util.Optional<SymbolicName>
getSymbolicName()
Condition
hasLabels(java.lang.String... labelsToQuery)
A condition that checks for the presence of labels on a node.FunctionInvocation
internalId()
Condition
isEqualTo(Node otherNode)
Creates a new condition whether this node is equal to otherNode.Condition
isNotEqualTo(Node otherNode)
Creates a new condition whether this node is not equal to otherNode.Condition
isNotNull()
Creates a new condition based on this node whether it is not null.Condition
isNull()
Creates a new condition based on this node whether it is null.FunctionInvocation
labels()
Operation
mutate(MapExpression properties)
Creates anOperation
mutating the properties of this container to a new value.Operation
mutate(Parameter parameter)
Creates anOperation
mutating the properties of this container to a new value.SELF
named(java.lang.String newSymbolicName)
Creates a copy of this node with a new symbolic name.abstract SELF
named(SymbolicName newSymbolicName)
This method needs to be implemented to provide new, type safe instances of this node.MapProjection
project(java.lang.Object... entries)
Creates a map projection based on this container.MapProjection
project(java.util.List<java.lang.Object> entries)
Unwraps the list of entries into an array before creating a projection out of it.Property
property(java.lang.String name)
Creates a newProperty
associated with this property container.Property
property(java.lang.String... names)
Property
property(Expression lookup)
Creates a newProperty
associated with this property container.Relationship
relationshipBetween(Node other, java.lang.String... types)
Starts building an undirected relationship between thisnode
and theother
.Relationship
relationshipFrom(Node other, java.lang.String... types)
Starts building an incoming relationship starting at theother
node
.Relationship
relationshipTo(Node other, java.lang.String... types)
Starts building an outgoing relationship to theother
node
.SELF
withProperties(java.lang.Object... keysAndValues)
Creates a a copy of this property container with additional properties.SELF
withProperties(java.util.Map<java.lang.String,java.lang.Object> newProperties)
Creates a a copy of this property container with additional properties.abstract SELF
withProperties(MapExpression newProperties)
This method needs to be implemented to provide new, type safe instances of this node.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.neo4j.cypherdsl.core.ExposesRelationships
relationshipBetween, relationshipFrom, relationshipTo
-
Methods inherited from interface org.neo4j.cypherdsl.core.Node
as, ascending, descending, hasLabels, internalId, isEqualTo, isNotEqualTo, isNotNull, isNull, labels
-
-
-
-
Constructor Detail
-
NodeBase
protected NodeBase(java.lang.String primaryLabel, java.lang.String... additionalLabels)
-
NodeBase
protected NodeBase(SymbolicName symbolicName, java.util.List<NodeLabel> labels, Properties properties)
-
-
Method Detail
-
named
public final SELF named(java.lang.String newSymbolicName)
Description copied from interface:Node
Creates a copy of this node with a new symbolic name.
-
named
public abstract SELF named(SymbolicName newSymbolicName)
This method needs to be implemented to provide new, type safe instances of this node.
-
withProperties
public final SELF withProperties(java.lang.Object... keysAndValues)
Description copied from interface:ExposesProperties
Creates a a copy of this property container with additional properties. Creates a property container without properties when no properties are passed to this method.- Specified by:
withProperties
in interfaceExposesProperties<SELF extends Node>
- Parameters:
keysAndValues
- A list of key and values. Must be an even number, with alternatingString
andExpression
.- Returns:
- The new property container.
-
withProperties
public final SELF withProperties(java.util.Map<java.lang.String,java.lang.Object> newProperties)
Description copied from interface:ExposesProperties
Creates a a copy of this property container with additional properties.- Specified by:
withProperties
in interfaceExposesProperties<SELF extends Node>
- Parameters:
newProperties
- A map with the new properties- Returns:
- The new property container.
-
withProperties
public abstract SELF withProperties(MapExpression newProperties)
This method needs to be implemented to provide new, type safe instances of this node.- Specified by:
withProperties
in interfaceExposesProperties<SELF extends Node>
- Parameters:
newProperties
- the new properties (can be null to remove exiting properties).- Returns:
- A new node
-
getProperties
protected final Properties getProperties()
-
getLabels
public final java.util.List<NodeLabel> getLabels()
-
getSymbolicName
public final java.util.Optional<SymbolicName> getSymbolicName()
- Specified by:
getSymbolicName
in interfaceNamed
- Returns:
- An optional symbolic name.
-
getRequiredSymbolicName
public final SymbolicName getRequiredSymbolicName()
- Specified by:
getRequiredSymbolicName
in interfaceNamed
- Returns:
- A symbolic name
-
hasLabels
public final Condition hasLabels(java.lang.String... labelsToQuery)
Description copied from interface:Node
A condition that checks for the presence of labels on a node.
-
isEqualTo
public final Condition isEqualTo(Node otherNode)
Description copied from interface:Node
Creates a new condition whether this node is equal to otherNode.
-
isNotEqualTo
public final Condition isNotEqualTo(Node otherNode)
Description copied from interface:Node
Creates a new condition whether this node is not equal to otherNode.- Specified by:
isNotEqualTo
in interfaceNode
- Parameters:
otherNode
- The node to compare this node to.- Returns:
- A condition.
-
isNull
public final Condition isNull()
Description copied from interface:Node
Creates a new condition based on this node whether it is null.
-
isNotNull
public final Condition isNotNull()
Description copied from interface:Node
Creates a new condition based on this node whether it is not null.
-
descending
public final SortItem descending()
Description copied from interface:Node
Creates a new sort item of this node in descending order.- Specified by:
descending
in interfaceNode
- Returns:
- A sort item.
-
ascending
public final SortItem ascending()
Description copied from interface:Node
Creates a new sort item of this node in ascending order.
-
as
public final AliasedExpression as(java.lang.String alias)
Description copied from interface:Node
Creates an alias for this node.
-
internalId
public final FunctionInvocation internalId()
- Specified by:
internalId
in interfaceNode
- Returns:
- A new function invocation returning the internal id of this node.
-
labels
public final FunctionInvocation labels()
-
relationshipTo
public final Relationship relationshipTo(Node other, java.lang.String... types)
Description copied from interface:ExposesRelationships
Starts building an outgoing relationship to theother
node
.- Specified by:
relationshipTo
in interfaceExposesRelationships<Relationship>
- Parameters:
other
- The other end of the outgoing relationshiptypes
- The types to match- Returns:
- An ongoing relationship definition, that can be used to specify the type
-
relationshipFrom
public final Relationship relationshipFrom(Node other, java.lang.String... types)
Description copied from interface:ExposesRelationships
Starts building an incoming relationship starting at theother
node
.- Specified by:
relationshipFrom
in interfaceExposesRelationships<Relationship>
- Parameters:
other
- The source of the incoming relationshiptypes
- The types to match- Returns:
- An ongoing relationship definition, that can be used to specify the type
-
relationshipBetween
public final Relationship relationshipBetween(Node other, java.lang.String... types)
Description copied from interface:ExposesRelationships
Starts building an undirected relationship between thisnode
and theother
.- Specified by:
relationshipBetween
in interfaceExposesRelationships<Relationship>
- Parameters:
other
- The other end of the relationshiptypes
- The types to match- Returns:
- An ongoing relationship definition, that can be used to specify the type
-
property
public final Property property(java.lang.String name)
Description copied from interface:PropertyContainer
Creates a newProperty
associated with this property container. This property can be used as a lookup in other expressions. It does not add a value to the property.Note: The property container does not track property creation and there is no possibility to enumerate all properties that have been created for this property container.
- Specified by:
property
in interfacePropertyContainer
- Parameters:
name
- property name, must not be null or empty.- Returns:
- a new
Property
associated with this named container
-
property
public final Property property(java.lang.String... names)
- Specified by:
property
in interfacePropertyContainer
-
property
public final Property property(Expression lookup)
Description copied from interface:PropertyContainer
Creates a newProperty
associated with this property container. This property can be used as a lookup in other expressions. It does not add a value to the property.The new
Property
object is a dynamic lookup, based on theexpression
passed to this method. The expression can be example another property, a function result or a Cypher parameter. A property defined in such a way will render asp[expression]
.Note: The property container does not track property creation and there is no possibility to enumerate all properties that have been created for this property container.
- Specified by:
property
in interfacePropertyContainer
- Parameters:
lookup
- the expression that is evaluated to lookup this property.- Returns:
- a new
Property
associated with this named container
-
mutate
public final Operation mutate(Parameter parameter)
Description copied from interface:PropertyContainer
Creates anOperation
mutating the properties of this container to a new value. The container does not track the operations created with this method.- Specified by:
mutate
in interfacePropertyContainer
- Parameters:
parameter
- the new properties- Returns:
- A new operation.
-
mutate
public final Operation mutate(MapExpression properties)
Description copied from interface:PropertyContainer
Creates anOperation
mutating the properties of this container to a new value. The container does not track the operations created with this method.- Specified by:
mutate
in interfacePropertyContainer
- Parameters:
properties
- the new properties- Returns:
- A new operation.
-
project
public final MapProjection project(java.util.List<java.lang.Object> entries)
Description copied from interface:PropertyContainer
Unwraps the list of entries into an array before creating a projection out of it.- Specified by:
project
in interfacePropertyContainer
- Parameters:
entries
- A list of entries for the projection- Returns:
- A map projection.
- See Also:
SymbolicName.project(List)
-
project
public final MapProjection project(java.lang.Object... entries)
Description copied from interface:PropertyContainer
Creates a map projection based on this container. The container needs a symbolic name for this to work.- Specified by:
project
in interfacePropertyContainer
- Parameters:
entries
- A list of entries for the projection- Returns:
- A map projection.
- See Also:
SymbolicName.project(Object...)
-
-