@Beta public final class StructuredQuery extends Object implements QuerySerializable
StructuredQuery
acts as a builder for OData 2.0 or 4.0 queries. It assists with assembling request parameters
such as $select, $filter, ...
. This API does not differentiate between OData versions. Only leveraging
features e.g. within filters that conform to the selected protocol version is the responsibility of the consumer.Modifier and Type | Method and Description |
---|---|
static StructuredQuery |
asNestedQueryOnProperty(String fieldName,
ODataProtocol protocol)
Create a nested query on a property.
|
StructuredQuery |
filter(ValueBoolean... filters) |
Collection<StructuredQuery> |
getComplexSelectors() |
String |
getEncodedQueryString()
Compute the encoded string representation of this query.
|
String |
getEntityOrPropertyName()
The structured property field name.
|
Collection<ValueBoolean> |
getFilters() |
OrderExpression |
getOrderBy() |
ODataProtocol |
getProtocol() |
String |
getQueryString()
Compute the string representation of this query
|
String |
getSearch() |
Collection<String> |
getSimpleSelectors() |
Number |
getSkip() |
Number |
getTop() |
boolean |
isRoot() |
static StructuredQuery |
onEntity(String entityName,
ODataProtocol protocol)
Create a
StructuredQuery for building up OData 2.0 or 4.0 queries. |
StructuredQuery |
orderBy(OrderExpression ordering) |
StructuredQuery |
orderBy(String field,
Order order) |
StructuredQuery |
search(String search) |
StructuredQuery |
select(String... fields)
Query modifier to limit which field values of the entity get fetched and populated.
|
StructuredQuery |
select(StructuredQuery... subqueries)
Query modifier to limit which complex and navigational properties will be expanded (and thus selected).
|
StructuredQuery |
skip(Number skip) |
StructuredQuery |
top(Number top) |
@Nonnull public static StructuredQuery onEntity(@Nonnull String entityName, @Nonnull ODataProtocol protocol)
StructuredQuery
for building up OData 2.0 or 4.0 queries.entityName
- The entity collection to be queried.protocol
- The ODataProtocol
version this query should conform to.StructuredQuery
object.@Nonnull public static StructuredQuery asNestedQueryOnProperty(@Nonnull String fieldName, @Nonnull ODataProtocol protocol)
fieldName
- The property that is to be queried.protocol
- The ODataProtocol
version this query should conform to.StructuredQuery
object.@Nonnull public StructuredQuery select(@Nonnull String... fields)
fields
- Properties to be selected.@Nonnull public StructuredQuery select(@Nonnull StructuredQuery... subqueries)
subqueries
- Query objects on properties to be expanded. The getEntityOrPropertyName()
will
be th@Nonnull public final StructuredQuery filter(@Nonnull ValueBoolean... filters)
@Nonnull public StructuredQuery top(@Nonnull Number top)
@Nonnull public StructuredQuery skip(@Nonnull Number skip)
@Nonnull public StructuredQuery orderBy(@Nonnull OrderExpression ordering)
@Nonnull public StructuredQuery search(@Nonnull String search)
@Nonnull public String getEncodedQueryString()
QuerySerializable
getEncodedQueryString
in interface QuerySerializable
@Nonnull public String getQueryString()
QuerySerializable
getQueryString
in interface QuerySerializable
@Nonnull public String getEntityOrPropertyName()
public boolean isRoot()
public ODataProtocol getProtocol()
@Nonnull public Collection<String> getSimpleSelectors()
@Nonnull public Collection<StructuredQuery> getComplexSelectors()
@Nonnull public Collection<ValueBoolean> getFilters()
@Nullable public OrderExpression getOrderBy()
Copyright © 2020 SAP SE. All rights reserved.