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:
Visitable,ExposesProperties<Node>,ExposesRelationships<Relationship>,IdentifiableElement,Named,Node,PatternElement,PropertyContainer
@API(status=STABLE, since="2021.1.0") public abstract class NodeBase<SELF extends Node> extends Object implements NodeThis 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 protectedNodeBase(String primaryLabel, String... additionalLabels)protectedNodeBase(SymbolicName symbolicName, List<NodeLabel> labels, Properties properties)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaccept(Visitor visitor)@NotNull AliasedExpressionas(String alias)Creates an alias for this node.@NotNull SortItemascending()Creates a new sort item of this node in ascending order.@NotNull SortItemdescending()Creates a new sort item of this node in descending order.@NotNull List<NodeLabel>getLabels()protected PropertiesgetProperties()@NotNull SymbolicNamegetRequiredSymbolicName()@NotNull Optional<SymbolicName>getSymbolicName()@NotNull ConditionhasLabels(String... labelsToQuery)A condition that checks for the presence of labels on a node.@NotNull FunctionInvocationinternalId()@NotNull ConditionisEqualTo(Node otherNode)Creates a new condition whether this node is equal to otherNode.@NotNull ConditionisNotEqualTo(Node otherNode)Creates a new condition whether this node is not equal to otherNode.@NotNull ConditionisNotNull()Creates a new condition based on this node whether it is not null.@NotNull ConditionisNull()Creates a new condition based on this node whether it is null.@NotNull FunctionInvocationlabels()@NotNull Operationmutate(MapExpression properties)Creates anOperationmutating the properties of this container to a new value.@NotNull Operationmutate(Parameter<?> parameter)Creates anOperationmutating the properties of this container to a new value.SELFnamed(String newSymbolicName)Creates a copy of this node with a new symbolic name.abstract SELFnamed(SymbolicName newSymbolicName)This method needs to be implemented to provide new, type safe instances of this node.@NotNull MapProjectionproject(Object... entries)Creates a map projection based on this container.@NotNull MapProjectionproject(List<Object> entries)Unwraps the list of entries into an array before creating a projection out of it.@NotNull Propertyproperty(@NotNull String name)Creates a newPropertyassociated with this property container.@NotNull Propertyproperty(String... names)@NotNull Propertyproperty(Expression lookup)Creates a newPropertyassociated with this property container.@NotNull RelationshiprelationshipBetween(Node other, String... types)Starts building an undirected relationship between thisnodeand theother.@NotNull RelationshiprelationshipFrom(Node other, String... types)Starts building an incoming relationship starting at theothernode.@NotNull RelationshiprelationshipTo(Node other, String... types)Starts building an outgoing relationship to theothernode.@NotNull Operationset(MapExpression properties)Creates anSET operationsetting the properties of this container to a new value.@NotNull Operationset(Parameter<?> parameter)Creates anSET operationsetting the properties of this container to a new value.SELFwithProperties(Object... keysAndValues)Creates a a copy of this property container with additional properties.SELFwithProperties(Map<String,Object> newProperties)Creates a a copy of this property container with additional properties.abstract SELFwithProperties(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.Named
asExpression
-
Methods inherited from interface org.neo4j.cypherdsl.core.Node
as, ascending, descending, elementId, hasLabels, internalId, isEqualTo, isNotEqualTo, isNotNull, isNull, labels
-
-
-
-
Constructor Detail
-
NodeBase
protected NodeBase(SymbolicName symbolicName, List<NodeLabel> labels, Properties properties)
-
-
Method Detail
-
named
public final SELF named(String newSymbolicName)
Description copied from interface:NodeCreates a copy of this node with a new symbolic name.
-
named
@NotNull public abstract SELF named(SymbolicName newSymbolicName)
This method needs to be implemented to provide new, type safe instances of this node.
-
withProperties
@NotNull public final SELF withProperties(Object... keysAndValues)
Description copied from interface:ExposesPropertiesCreates 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:
withPropertiesin interfaceExposesProperties<SELF extends Node>- Parameters:
keysAndValues- A list of key and values. Must be an even number, with alternatingStringandExpression.- Returns:
- The new property container.
-
withProperties
@NotNull public final SELF withProperties(Map<String,Object> newProperties)
Description copied from interface:ExposesPropertiesCreates a a copy of this property container with additional properties.- Specified by:
withPropertiesin interfaceExposesProperties<SELF extends Node>- Parameters:
newProperties- A map with the new properties- Returns:
- The new property container.
-
withProperties
@NotNull public abstract SELF withProperties(MapExpression newProperties)
This method needs to be implemented to provide new, type safe instances of this node.- Specified by:
withPropertiesin 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()
-
getSymbolicName
@NotNull public final @NotNull Optional<SymbolicName> getSymbolicName()
- Specified by:
getSymbolicNamein interfaceNamed- Returns:
- An optional symbolic name.
-
getRequiredSymbolicName
@NotNull public final @NotNull SymbolicName getRequiredSymbolicName()
- Specified by:
getRequiredSymbolicNamein interfaceNamed- Returns:
- A symbolic name
-
hasLabels
@NotNull public final @NotNull Condition hasLabels(String... labelsToQuery)
Description copied from interface:NodeA condition that checks for the presence of labels on a node.
-
isEqualTo
@NotNull public final @NotNull Condition isEqualTo(Node otherNode)
Description copied from interface:NodeCreates a new condition whether this node is equal to otherNode.
-
isNotEqualTo
@NotNull public final @NotNull Condition isNotEqualTo(Node otherNode)
Description copied from interface:NodeCreates a new condition whether this node is not equal to otherNode.- Specified by:
isNotEqualToin interfaceNode- Parameters:
otherNode- The node to compare this node to.- Returns:
- A condition.
-
isNull
@NotNull public final @NotNull Condition isNull()
Description copied from interface:NodeCreates a new condition based on this node whether it is null.
-
isNotNull
@NotNull public final @NotNull Condition isNotNull()
Description copied from interface:NodeCreates a new condition based on this node whether it is not null.
-
descending
@NotNull public final @NotNull SortItem descending()
Description copied from interface:NodeCreates a new sort item of this node in descending order.- Specified by:
descendingin interfaceNode- Returns:
- A sort item.
-
ascending
@NotNull public final @NotNull SortItem ascending()
Description copied from interface:NodeCreates a new sort item of this node in ascending order.
-
as
@NotNull public final @NotNull AliasedExpression as(String alias)
Description copied from interface:NodeCreates an alias for this node.
-
internalId
@NotNull public final @NotNull FunctionInvocation internalId()
- Specified by:
internalIdin interfaceNode- Returns:
- A new function invocation returning the internal id of this node.
-
labels
@NotNull public final @NotNull FunctionInvocation labels()
-
relationshipTo
@NotNull public final @NotNull Relationship relationshipTo(Node other, String... types)
Description copied from interface:ExposesRelationshipsStarts building an outgoing relationship to theothernode.- Specified by:
relationshipToin 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
@NotNull public final @NotNull Relationship relationshipFrom(Node other, String... types)
Description copied from interface:ExposesRelationshipsStarts building an incoming relationship starting at theothernode.- Specified by:
relationshipFromin 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
@NotNull public final @NotNull Relationship relationshipBetween(Node other, String... types)
Description copied from interface:ExposesRelationshipsStarts building an undirected relationship between thisnodeand theother.- Specified by:
relationshipBetweenin 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
@NotNull public final @NotNull Property property(@NotNull @NotNull String name)
Description copied from interface:PropertyContainerCreates a newPropertyassociated 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:
propertyin interfacePropertyContainer- Parameters:
name- property name, must not be null or empty.- Returns:
- a new
Propertyassociated with this named container
-
property
@NotNull public final @NotNull Property property(String... names)
- Specified by:
propertyin interfacePropertyContainer- Parameters:
names- a list of nested property names- Returns:
- a new
Propertyassociated with this named container - See Also:
PropertyContainer.property(String)
-
property
@NotNull public final @NotNull Property property(Expression lookup)
Description copied from interface:PropertyContainerCreates a newPropertyassociated 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
Propertyobject is a dynamic lookup, based on theexpressionpassed 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:
propertyin interfacePropertyContainer- Parameters:
lookup- the expression that is evaluated to lookup this property.- Returns:
- a new
Propertyassociated with this named container
-
mutate
@NotNull public final @NotNull Operation mutate(Parameter<?> parameter)
Description copied from interface:PropertyContainerCreates anOperationmutating the properties of this container to a new value. The container does not track the operations created with this method.- Specified by:
mutatein interfacePropertyContainer- Parameters:
parameter- the new properties- Returns:
- A new operation.
-
mutate
@NotNull public final @NotNull Operation mutate(MapExpression properties)
Description copied from interface:PropertyContainerCreates anOperationmutating the properties of this container to a new value. The container does not track the operations created with this method.- Specified by:
mutatein interfacePropertyContainer- Parameters:
properties- the new properties- Returns:
- A new operation.
-
set
@NotNull public final @NotNull Operation set(Parameter<?> parameter)
Description copied from interface:PropertyContainerCreates anSET operationsetting the properties of this container to a new value. The container does not track the operations created with this method.- Specified by:
setin interfacePropertyContainer- Parameters:
parameter- the new properties- Returns:
- A new operation.
-
set
@NotNull public final @NotNull Operation set(MapExpression properties)
Description copied from interface:PropertyContainerCreates anSET operationsetting the properties of this container to a new value. The container does not track the operations created with this method.- Specified by:
setin interfacePropertyContainer- Parameters:
properties- the new properties- Returns:
- A new operation.
-
project
@NotNull public final @NotNull MapProjection project(List<Object> entries)
Description copied from interface:PropertyContainerUnwraps the list of entries into an array before creating a projection out of it.- Specified by:
projectin interfacePropertyContainer- Parameters:
entries- A list of entries for the projection- Returns:
- A map projection.
- See Also:
SymbolicName.project(List)
-
project
@NotNull public final @NotNull MapProjection project(Object... entries)
Description copied from interface:PropertyContainerCreates a map projection based on this container. The container needs a symbolic name for this to work.- Specified by:
projectin interfacePropertyContainer- Parameters:
entries- A list of entries for the projection- Returns:
- A map projection.
- See Also:
SymbolicName.project(Object...)
-
-