Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wrapper to builder (#806) #816

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Expose HTTP status code through `ResponseException#status` ([#756](https://github.com/opensearch-project/opensearch-java/pull/756))
- Added toBuilder method to all request model in core package & _types.query_dsl package ([#766](https://github.com/opensearch-project/opensearch-java/pull/766))
- Added toQuery method in Query and QueryVariant ([#760](https://github.com/opensearch-project/opensearch-java/pull/760)
- Added missing WrapperQuery accessors and builder methods ([#806](https://github.com/opensearch-project/opensearch-java/pull/806))

### Dependencies
- Bumps `com.diffplug.spotless` from 6.22.0 to 6.24.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,23 @@ public WildcardQuery wildcard() {
return TaggedUnionUtils.get(this, Kind.Wildcard);
}

/**
* Is this variant instance of kind {@code wrapper}?
*/
public boolean isWrapper() {
return this._kind == Query.Kind.Wrapper;
}

/**
* Get the {@code wrapper} variant value.
*
* @throws IllegalStateException
* if the current variant is not of the {@code wrapper} kind.
*/
public WrapperQuery wrapper() {
return (WrapperQuery) TaggedUnionUtils.get(this, Query.Kind.Wrapper);
}

/**
* Is this variant instance of kind {@code type}?
*/
Expand Down Expand Up @@ -1743,6 +1760,16 @@ public ObjectBuilder<Query> wildcard(Function<WildcardQuery.Builder, ObjectBuild
return this.wildcard(fn.apply(new WildcardQuery.Builder()).build());
}

public ObjectBuilder<Query> wrapper(WrapperQuery v) {
this._kind = Query.Kind.Wrapper;
this._value = v;
return this;
}

public ObjectBuilder<Query> wrapper(Function<WrapperQuery.Builder, ObjectBuilder<WrapperQuery>> fn) {
return this.wrapper(fn.apply(new WrapperQuery.Builder()).build());
}

public ObjectBuilder<Query> type(TypeQuery v) {
this._kind = Kind.Type;
this._value = v;
Expand Down
Loading