-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create the common interface
HasProperties
to unify access to proper…
…ties
- Loading branch information
Showing
4 changed files
with
111 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
neo4j-cypher-dsl/src/main/java/org/neo4j/cypherdsl/core/HasProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Copyright (c) 2019-2024 "Neo4j," | ||
* Neo4j Sweden AB [https://neo4j.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.neo4j.cypherdsl.core; | ||
|
||
import static org.apiguardian.api.API.Status.STABLE; | ||
|
||
import org.apiguardian.api.API; | ||
import org.jetbrains.annotations.Contract; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* This interface represents an element that can be for example an identifiable part of the {@code WITH} clause. | ||
* It has been introduced to circumvent the absence of union types in Java | ||
* and to avoid an overload of {@link StatementBuilder#with(String...)} or other expressions with an {@code Object...} | ||
* parameter. This type here allows passing {@link Named named things}. {@link AliasedExpression aliased expression}, | ||
* {@link SymbolicName symobolic names} into a pipeline. | ||
* <p> | ||
* There should be no need to implement this on your own. | ||
* | ||
* @author Andreas Berger | ||
* @since 2023.9.4 | ||
*/ | ||
@API(status = STABLE, since = "2023.9.4") | ||
public interface HasProperties { | ||
|
||
/** | ||
* Creates a new {@link Property} 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. | ||
* <p> | ||
* 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. | ||
* | ||
* @param name property name, must not be {@literal null} or empty. | ||
* @return a new {@link Property} associated with this named container | ||
* @since 2023.9.4 | ||
*/ | ||
@NotNull @Contract(pure = true) | ||
Property property(@NotNull String name); | ||
|
||
/** | ||
* @param names a list of nested property names | ||
* @return a new {@link Property} associated with this named container | ||
* @see #property(String) | ||
* @since 2023.9.4 | ||
*/ | ||
@NotNull @Contract(pure = true) | ||
Property property(String... names); | ||
|
||
/** | ||
* Creates a new {@link Property} 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. | ||
* <p> | ||
* The new {@link Property} object is a dynamic lookup, based on the {@code expression} 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 as {@code p[expression]}. | ||
* <p> | ||
* 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. | ||
* | ||
* @param lookup the expression that is evaluated to lookup this property. | ||
* @return a new {@link Property} associated with this named container | ||
* @since 2023.9.4 | ||
*/ | ||
@NotNull @Contract(pure = true) | ||
Property property(@NotNull Expression lookup); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters