Package ch.usi.si.seart.treesitter
Class Query.Builder
- java.lang.Object
-
- ch.usi.si.seart.treesitter.Query.Builder
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Querybuild()Builds and returns a new Query instance with the configured language and pattern.Query.Builderlanguage(@NotNull Language language)Sets the programming language associated with the query.Query.Builderpattern()Removes all currently specified query patterns.Query.Builderpattern(@NotNull String pattern)Adds a symbolic expression to the collection of patterns that the Query will use to match nodes.Query.Builderpatterns(@NotNull String... patterns)Adds multiple symbolic expression to the collection of patterns that the Query will use to match nodes.Query.Builderpatterns(@NotNull List<@NotNull String> patterns)Sets the collection of patterns that the Query will use to match nodes.
-
-
-
Method Detail
-
language
public Query.Builder language(@NotNull @NotNull Language language)
Sets the programming language associated with the query.- Parameters:
language- The language associated with the query- Returns:
- this builder
- Throws:
NullPointerException- if the language is nullUnsatisfiedLinkError- if the language was not linked to native codeABIVersionError- if the language ABI version is incompatible with requirements
-
patterns
public Query.Builder patterns(@NotNull @NotNull List<@NotNull String> patterns)
Sets the collection of patterns that the Query will use to match nodes. This method will overwrite all the currently specified patterns.- Parameters:
patterns- A list of symbolic expression strings that make up the pattern- Returns:
- this builder
- Throws:
NullPointerException- if the pattern list is null or contains null elements- Since:
- 1.8.0
-
patterns
public Query.Builder patterns(@NotNull @NotNull String... patterns)
Adds multiple symbolic expression to the collection of patterns that the Query will use to match nodes.- Parameters:
patterns- A sequence of symbolic expression strings that make up the pattern- Returns:
- this builder
- Throws:
NullPointerException- if the pattern sequence is null- Since:
- 1.8.0
-
pattern
public Query.Builder pattern(@NotNull @NotNull String pattern)
Adds a symbolic expression to the collection of patterns that the Query will use to match nodes.- Parameters:
pattern- The symbolic expression string of the query pattern- Returns:
- this builder
- Throws:
NullPointerException- if the pattern is null
-
pattern
public Query.Builder pattern()
Removes all currently specified query patterns.- Returns:
- this builder
- Since:
- 1.8.0
-
build
public Query build()
Builds and returns a new Query instance with the configured language and pattern.- Returns:
- A new query instance
- Throws:
QueryException- if query construction fails
-
-