public class QueryUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static IQuery<IInstallableUnit> |
ALL_UNITS |
static java.lang.String |
ANY |
static IQuery<IInstallableUnit> |
NO_UNITS |
static java.lang.String |
PROP_TYPE_CATEGORY |
static java.lang.String |
PROP_TYPE_GROUP |
static java.lang.String |
PROP_TYPE_PATCH |
| Constructor and Description |
|---|
QueryUtil() |
| Modifier and Type | Method and Description |
|---|---|
static <T> IQueryable<T> |
compoundQueryable(java.util.Collection<? extends IQueryable<T>> queryables)
Creates a queryable that combines the given collection of input queryables
|
static <T> IQueryable<T> |
compoundQueryable(IQueryable<T> query1,
IQueryable<T> query2)
Creates a queryable that combines the two provided input queryables
|
static <T> IQuery<T> |
createCompoundQuery(java.util.Collection<? extends IQuery<? extends T>> queries,
boolean and)
Creates a compound query that combines the given queries.
|
static <T> IQuery<T> |
createCompoundQuery(IQuery<? extends T> query1,
IQuery<T> query2,
boolean and)
Creates a compound query that combines the two queries.
|
static IQuery<IInstallableUnit> |
createIUAnyQuery()
Returns a query that matches all
InstallableUnit elements |
static IQuery<IInstallableUnit> |
createIUCategoryMemberQuery(IInstallableUnit category)
Creates a new query that will return the members of the
given
category. |
static IQuery<IInstallableUnit> |
createIUCategoryQuery()
Creates a query matching every
IInstallableUnit that is a category. |
static IQuery<IInstallableUnit> |
createIUGroupQuery()
Creates a query matching every
IInstallableUnit that is a group. |
static IQuery<IInstallableUnit> |
createIUPatchQuery()
Creates an
IInstallableUnit that will match all patches. |
static IQuery<IInstallableUnit> |
createIUProductQuery()
Creates an
IInstallableUnit that will match all products. |
static IQuery<IInstallableUnit> |
createIUPropertyQuery(java.lang.String propertyName,
java.lang.String propertyValue)
Creates a query that searches for
IInstallableUnit instances that have
a property whose value matches the provided value. |
static IQuery<IInstallableUnit> |
createIUQuery(IVersionedId versionedId)
Creates a query that will match any
IInstallableUnit with the given
id and version. |
static IQuery<IInstallableUnit> |
createIUQuery(java.lang.String id)
Creates a query that will match any
IInstallableUnit with the given
id, regardless of version. |
static IQuery<IInstallableUnit> |
createIUQuery(java.lang.String id,
Version version)
Creates a query that will match any
IInstallableUnit with the given
id and version. |
static IQuery<IInstallableUnit> |
createIUQuery(java.lang.String id,
VersionRange range)
Creates a query that will match any
IInstallableUnit with the given
id, and whose version falls in the provided range. |
static IQuery<IInstallableUnit> |
createLatestIUQuery()
Creates a query that returns the latest version for each unique id of an
IVersionedId. |
static <T extends IVersionedId> |
createLatestQuery(IQuery<T> query)
Creates a query that returns the latest version for each unique id of an
IVersionedId
from the collection produced by query. |
static <T> IQuery<T> |
createLimitQuery(IQuery<T> query,
int limit)
Creates a limit query that can be used to limit the number of query results returned.
|
static <T> IQuery<T> |
createMatchQuery(java.lang.Class<? extends T> matchingClass,
IExpression matchExpression,
java.lang.Object... parameters)
Creates an query that will iterate over all candidates and discriminate all
candidates that are not instances of
matchingClass or for which
the boolean matchExpression returns false. |
static <T> IQuery<T> |
createMatchQuery(java.lang.Class<? extends T> matchingClass,
java.lang.String matchExpression,
java.lang.Object... parameters)
Parses the
matchExpression and creates an query that will iterate over
all candidates and discriminate all candidates that are not instances of
matchingClass or for which the boolean matchExpression
returns false. |
static IQuery<IInstallableUnit> |
createMatchQuery(IExpression matchExpression,
java.lang.Object... parameters)
Creates an
IInstallableUnit query that will iterate over all candidates and discriminate by
applying the boolean matchExpression on each candidate. |
static IQuery<IInstallableUnit> |
createMatchQuery(java.lang.String matchExpression,
java.lang.Object... parameters)
Parses the
matchExpression and creates an IInstallableUnit query that will
iterate over all candidates and discriminate by applying the boolean matchExpression
on each candidate. |
static <T> IQuery<T> |
createPipeQuery(java.util.Collection<? extends IQuery<? extends T>> queries)
Creates a piped query based on the provided input queries.
|
static <T> IQuery<T> |
createPipeQuery(IQuery<? extends T> query1,
IQuery<? extends T> query2)
Creates a piped query based on the provided input queries.
|
static <T> IQuery<T> |
createQuery(java.lang.Class<? extends T> matchingClass,
IExpression expression,
java.lang.Object... parameters)
Creates a query that will limit the result to instances of the
matchingClass. |
static <T> IQuery<T> |
createQuery(java.lang.Class<? extends T> matchingClass,
java.lang.String expression,
java.lang.Object... parameters)
Parses the
expression and creates a query that will limit the result
to instances of the matchingClass. |
static IQuery<IInstallableUnit> |
createQuery(IExpression expression,
java.lang.Object... parameters)
Creates an
IInstallableUnit query based on an expression that
uses all candidates as input. |
static IQuery<IInstallableUnit> |
createQuery(java.lang.String expression,
java.lang.Object... parameters)
Parses the
expression and creates an IInstallableUnit query. |
static boolean |
isCategory(IInstallableUnit iu)
Test if the
IInstallableUnit is a category. |
static boolean |
isFragment(IInstallableUnit iu)
Test if the
IInstallableUnit is a fragment. |
static boolean |
isGroup(IInstallableUnit iu)
Test if the
IInstallableUnit is a group. |
static boolean |
isPatch(IInstallableUnit iu)
Test if the
IInstallableUnit is a patch. |
static boolean |
isProduct(IInstallableUnit iu)
Test if the
IInstallableUnit is a product. |
public static final IQuery<IInstallableUnit> ALL_UNITS
public static final java.lang.String ANY
public static final IQuery<IInstallableUnit> NO_UNITS
public static final java.lang.String PROP_TYPE_CATEGORY
public static final java.lang.String PROP_TYPE_GROUP
public static final java.lang.String PROP_TYPE_PATCH
public static <T> IQueryable<T> compoundQueryable(java.util.Collection<? extends IQueryable<T>> queryables)
queryables - The collection of queryables to be combinedpublic static <T> IQueryable<T> compoundQueryable(IQueryable<T> query1, IQueryable<T> query2)
query1 - The first queryablequery2 - The second queryablepublic static <T> IQuery<T> createCompoundQuery(java.util.Collection<? extends IQuery<? extends T>> queries, boolean and)
and
flag. If at least one query is a full query, all queries will instead be evaluated
using intersection when and is true or a union.queries - The queries to performand - true if this query represents an intersection or a
logical 'and', and false if this query represents a union or
a logical 'or'.public static <T> IQuery<T> createCompoundQuery(IQuery<? extends T> query1, IQuery<T> query2, boolean and)
and
flag. If at least one query is a full query, all queries will instead be evaluated
using intersection when and is true or a union.query1 - the first queryquery2 - the second queryand - true if this query represents an intersection or a
logical 'and', and false if this query represents a union or
a logical 'or'.public static IQuery<IInstallableUnit> createIUAnyQuery()
InstallableUnit elementspublic static IQuery<IInstallableUnit> createIUCategoryMemberQuery(IInstallableUnit category)
category. If the specified IInstallableUnit
is not a category, then no installable unit will satisfy the query.category - The categorypublic static IQuery<IInstallableUnit> createIUCategoryQuery()
IInstallableUnit that is a category.public static IQuery<IInstallableUnit> createIUGroupQuery()
IInstallableUnit that is a group.public static IQuery<IInstallableUnit> createIUPatchQuery()
IInstallableUnit that will match all patches.public static IQuery<IInstallableUnit> createIUProductQuery()
IInstallableUnit that will match all products.public static IQuery<IInstallableUnit> createIUPropertyQuery(java.lang.String propertyName, java.lang.String propertyValue)
IInstallableUnit instances that have
a property whose value matches the provided value. If no property name is
specified, then all IInstallableUnit instances are accepted.propertyName - The key of the property to match or null to match allpropertyValue - The value of the property. Can be ANY to match all values
except nullpublic static IQuery<IInstallableUnit> createIUQuery(IVersionedId versionedId)
IInstallableUnit with the given
id and version.versionedId - The precise id/version combination that a matching unit must havepublic static IQuery<IInstallableUnit> createIUQuery(java.lang.String id)
IInstallableUnit with the given
id, regardless of version.id - The installable unit id to match, or null to match any idpublic static IQuery<IInstallableUnit> createIUQuery(java.lang.String id, Version version)
IInstallableUnit with the given
id and version.id - The installable unit id to match, or null to match any idversion - The precise version that a matching unit must have or null
to match any versionpublic static IQuery<IInstallableUnit> createIUQuery(java.lang.String id, VersionRange range)
IInstallableUnit with the given
id, and whose version falls in the provided range.id - The installable unit id to match, or null to match any idrange - The version range to match or null to match any range.public static IQuery<IInstallableUnit> createLatestIUQuery()
IVersionedId.
All other elements are discarded.public static <T extends IVersionedId> IQuery<T> createLatestQuery(IQuery<T> query)
IVersionedId
from the collection produced by query.
All other elements are discarded.query - The query that precedes the latest query when evaluating.public static <T> IQuery<T> createLimitQuery(IQuery<T> query, int limit)
query - The query that should be limitedlimit - A positive integer denoting the limitpublic static IQuery<IInstallableUnit> createMatchQuery(IExpression matchExpression, java.lang.Object... parameters)
IInstallableUnit query that will iterate over all candidates and discriminate by
applying the boolean matchExpression on each candidate.matchExpression - The boolean expression used for filtering one candidateparameters - Values for parameter substitutionpublic static IQuery<IInstallableUnit> createMatchQuery(java.lang.String matchExpression, java.lang.Object... parameters)
matchExpression and creates an IInstallableUnit query that will
iterate over all candidates and discriminate by applying the boolean matchExpression
on each candidate.matchExpression - The boolean expression used for filtering one candidateparameters - Values for parameter substitutionpublic static <T> IQuery<T> createMatchQuery(java.lang.Class<? extends T> matchingClass, IExpression matchExpression, java.lang.Object... parameters)
matchingClass or for which
the boolean matchExpression returns false.matchingClass - The class that matching candidates must be an instance ofmatchExpression - The boolean expression used for filtering one candidateparameters - Values for parameter substitutionpublic static <T> IQuery<T> createMatchQuery(java.lang.Class<? extends T> matchingClass, java.lang.String matchExpression, java.lang.Object... parameters)
matchExpression and creates an query that will iterate over
all candidates and discriminate all candidates that are not instances of
matchingClass or for which the boolean matchExpression
returns false.T - The type of input object that the created query acceptsmatchingClass - The class that matching candidates must be an instance ofmatchExpression - The boolean expression used for filtering one candidateparameters - Values for parameter substitutionpublic static <T> IQuery<T> createPipeQuery(java.util.Collection<? extends IQuery<? extends T>> queries)
Creates a piped query based on the provided input queries.
A pipe is a composite query in which each sub-query is executed in succession. The results from the ith sub-query are piped as input into the i+1th sub-query. The query will short-circuit if any query returns an empty result set.
queries - the ordered list of queries to performpublic static <T> IQuery<T> createPipeQuery(IQuery<? extends T> query1, IQuery<? extends T> query2)
Creates a piped query based on the provided input queries.
A pipe is a composite query in which each sub-query is executed in succession. The results from the ith sub-query are piped as input into the i+1th sub-query. The query will short-circuit if any query returns an empty result set.
query1 - the first queryquery2 - the second querypublic static IQuery<IInstallableUnit> createQuery(IExpression expression, java.lang.Object... parameters)
IInstallableUnit query based on an expression that
uses all candidates as input.expression - The query expressionparameters - Values for parameter substitutionpublic static IQuery<IInstallableUnit> createQuery(java.lang.String expression, java.lang.Object... parameters)
expression and creates an IInstallableUnit query. The
expression is expected to use all candidates as input.expression - The query expressionparameters - Values for parameter substitutionpublic static <T> IQuery<T> createQuery(java.lang.Class<? extends T> matchingClass, IExpression expression, java.lang.Object... parameters)
matchingClass. The
expression is expected to use all candidates as input.matchingClass - The class used as discriminator for the resultexpression - The query expressionparameters - Values for parameter substitutionpublic static <T> IQuery<T> createQuery(java.lang.Class<? extends T> matchingClass, java.lang.String expression, java.lang.Object... parameters)
expression and creates a query that will limit the result
to instances of the matchingClass. The expression is expected
to use all candidates as input.matchingClass - The class used as discriminator for the resultexpression - The query expressionparameters - Values for parameter substitutionpublic static boolean isCategory(IInstallableUnit iu)
IInstallableUnit is a category.iu - the element being tested.true if the parameter is a category.public static boolean isFragment(IInstallableUnit iu)
IInstallableUnit is a fragment.iu - the element being tested.true if the parameter is a fragment.public static boolean isGroup(IInstallableUnit iu)
IInstallableUnit is a group.iu - the element being tested.true if the parameter is a group.public static boolean isProduct(IInstallableUnit iu)
IInstallableUnit is a product.iu - the element being tested.true if the parameter is a group.public static boolean isPatch(IInstallableUnit iu)
IInstallableUnit is a patch.iu - the element being tested.true if the parameter is a patch.