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 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(java.lang.String primaryLabel, java.lang.String... additionalLabels)protectedNodeBase(SymbolicName symbolicName, java.util.List<NodeLabel> labels, Properties properties)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaccept(Visitor visitor)AliasedExpressionas(java.lang.String alias)Creates an alias for this node.SortItemascending()Creates a new sort item of this node in ascending order.SortItemdescending()Creates a new sort item of this node in descending order.java.util.List<NodeLabel>getLabels()protected PropertiesgetProperties()SymbolicNamegetRequiredSymbolicName()java.util.Optional<SymbolicName>getSymbolicName()ConditionhasLabels(java.lang.String... labelsToQuery)A condition that checks for the presence of labels on a node.FunctionInvocationinternalId()ConditionisEqualTo(Node otherNode)Creates a new condition whether this node is equal to otherNode.ConditionisNotEqualTo(Node otherNode)Creates a new condition whether this node is not equal to otherNode.ConditionisNotNull()Creates a new condition based on this node whether it is not null.ConditionisNull()Creates a new condition based on this node whether it is null.FunctionInvocationlabels()Operationmutate(MapExpression properties)Creates anOperationmutating the properties of this container to a new value.Operationmutate(Parameter parameter)Creates anOperationmutating the properties of this container to a new value.SELFnamed(java.lang.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.MapProjectionproject(java.lang.Object... entries)Creates a map projection based on this container.MapProjectionproject(java.util.List<java.lang.Object> entries)Unwraps the list of entries into an array before creating a projection out of it.Propertyproperty(java.lang.String name)Creates a newPropertyassociated with this property container.Propertyproperty(java.lang.String... names)Propertyproperty(Expression lookup)Creates a newPropertyassociated with this property container.RelationshiprelationshipBetween(Node other, java.lang.String... types)Starts building an undirected relationship between thisnodeand theother.RelationshiprelationshipFrom(Node other, java.lang.String... types)Starts building an incoming relationship starting at theothernode.RelationshiprelationshipTo(Node other, java.lang.String... types)Starts building an outgoing relationship to theothernode.SELFwithProperties(java.lang.Object... keysAndValues)Creates a a copy of this property container with additional properties.SELFwithProperties(java.util.Map<java.lang.String,java.lang.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.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:NodeCreates 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: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
public final SELF withProperties(java.util.Map<java.lang.String,java.lang.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
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()
-
getLabels
public final java.util.List<NodeLabel> getLabels()
-
getSymbolicName
public final java.util.Optional<SymbolicName> getSymbolicName()
- Specified by:
getSymbolicNamein interfaceNamed- Returns:
- An optional symbolic name.
-
getRequiredSymbolicName
public final SymbolicName getRequiredSymbolicName()
- Specified by:
getRequiredSymbolicNamein interfaceNamed- Returns:
- A symbolic name
-
hasLabels
public final Condition hasLabels(java.lang.String... labelsToQuery)
Description copied from interface:NodeA condition that checks for the presence of labels on a node.
-
isEqualTo
public final Condition isEqualTo(Node otherNode)
Description copied from interface:NodeCreates a new condition whether this node is equal to otherNode.
-
isNotEqualTo
public final 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
public final Condition isNull()
Description copied from interface:NodeCreates a new condition based on this node whether it is null.
-
isNotNull
public final Condition isNotNull()
Description copied from interface:NodeCreates a new condition based on this node whether it is not null.
-
descending
public final 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
public final SortItem ascending()
Description copied from interface:NodeCreates a new sort item of this node in ascending order.
-
as
public final AliasedExpression as(java.lang.String alias)
Description copied from interface:NodeCreates an alias for this node.
-
internalId
public final FunctionInvocation internalId()
- Specified by:
internalIdin 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: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
public final Relationship relationshipFrom(Node other, java.lang.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
public final Relationship relationshipBetween(Node other, java.lang.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
public final Property property(java.lang.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
public final Property property(java.lang.String... names)
- Specified by:
propertyin interfacePropertyContainer
-
property
public final 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
public final 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
public final 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.
-
project
public final MapProjection project(java.util.List<java.lang.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
public final MapProjection project(java.lang.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...)
-
-