Class Options.Builder

java.lang.Object
org.neo4j.cypherdsl.parser.Options.Builder
Enclosing class:
Options

public static final class Options.Builder extends Object
Use this builder to create a new set of options..
  • Method Details

    • withLabelFilter

      Configure a filter that is applied to labels.
      Parameters:
      labelFilter - Takes in an event type, a collection of labels and returns a probably new collection of labels.
      Returns:
      This builder.
    • withTypeFilter

      Configure a filter that is applied to types.
      Parameters:
      typeFilter - Takes in an event type and the parsed type. May return the type itself or something else.
      Returns:
      This builder.
    • withCallback

      public <T extends org.neo4j.cypherdsl.core.Expression> Options.Builder withCallback(ExpressionCreatedEventType expressionCreatedEventType, Class<T> resultingType, Function<org.neo4j.cypherdsl.core.Expression,T> callback)
      Adds a callback for when the specific expression is created event. For one type of event one or more callbacks can be declared which will be called in order in which they have been declared.

      Parsing will be aborted when a callback throws a RuntimeException.

      Type Parameters:
      T - The type of the expression produced by the callback. Must match the one of the event type
      Parameters:
      expressionCreatedEventType - The type of the event
      resultingType - The type of the expression the callback returns. Must match the one of the event type.
      callback - A callback
      Returns:
      This builder
    • withCallback

      public Options.Builder withCallback(PatternElementCreatedEventType patternElementCreatedEventType, UnaryOperator<org.neo4j.cypherdsl.core.PatternElement> callback)
      Adds a callback for when a PatternElement is created during one of the phases described by PatternElementCreatedEventType. For one type of event one or more callbacks can be declared which will be called in order in which they have been declared. Callbacks can just collect or actually visit the elements created or they are free to create new ones, effectively rewriting the query.

      Parsing will be aborted when a callback throws a RuntimeException.

      Parameters:
      patternElementCreatedEventType - The type of the event
      callback - A callback
      Returns:
      This builder
      Since:
      2022.2.0
    • withCallback

      public <T extends org.neo4j.cypherdsl.core.ast.Visitable> Options.Builder withCallback(InvocationCreatedEventType invocationCreatedEventType, Class<T> resultingType, UnaryOperator<T> callback)
      Adds a callback for when either a CALL-Procedure clause or a function-invocation expression is created. For one type of event one or more callbacks can be declared which will be called in order in which they have been declared. Callbacks can just collect or actually visit the elements created, or they are free to create new ones, effectively rewriting the query.

      Parsing will be aborted when a callback throws a RuntimeException.

      Type Parameters:
      T - The type of the result, must match the one of the event
      Parameters:
      invocationCreatedEventType - The event type
      callback - A callback
      Returns:
      this builder
      Since:
      2022.8.6
    • withReturnClauseFactory

      public Options.Builder withReturnClauseFactory(@Nullable @Nullable Function<ReturnDefinition,org.neo4j.cypherdsl.core.Return> returnClauseFactory)
      Configures the factory for return clauses. The idea here is that you might intercept what is being returned or how it is sorted, limited and the like. The definition passed to the factory contains all necessary information for delegating to the Clauses.returning(boolean, List, List, Expression, Expression) factory.
      Parameters:
      returnClauseFactory - The factory producing return classes that should be used.
      Returns:
      This builder
    • build

      public Options build()
      Returns:
      A new, unmodifiable options instance.