|
Eclipse Platform Release 3.6 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.equinox.p2.query.QueryUtil
public class QueryUtil
Helper class for query related tasks.
Field Summary | |
---|---|
static IQuery<IInstallableUnit> |
ALL_UNITS
|
static String |
ANY
|
static IQuery<IInstallableUnit> |
NO_UNITS
|
static String |
PROP_TYPE_CATEGORY
|
static String |
PROP_TYPE_GROUP
|
static String |
PROP_TYPE_PATCH
|
Constructor Summary | |
---|---|
QueryUtil()
|
Method Summary | ||
---|---|---|
static
|
compoundQueryable(Collection<? extends IQueryable<T>> queryables)
Creates a queryable that combines the given collection of input queryables |
|
static
|
compoundQueryable(IQueryable<T> query1,
IQueryable<T> query2)
Creates a queryable that combines the two provided input queryables |
|
static
|
createCompoundQuery(Collection<? extends IQuery<? extends T>> queries,
boolean and)
Creates a compound query that combines the given queries. |
|
static
|
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> |
createIUPropertyQuery(String propertyName,
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(String id)
Creates a query that will match any IInstallableUnit with the given
id, regardless of version. |
|
static IQuery<IInstallableUnit> |
createIUQuery(String id,
Version version)
Creates a query that will match any IInstallableUnit with the given
id and version. |
|
static IQuery<IInstallableUnit> |
createIUQuery(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
|
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
|
createLimitQuery(IQuery<T> query,
int limit)
Creates a limit query that can be used to limit the number of query results returned. |
|
static
|
createMatchQuery(Class<? extends T> matchingClass,
IExpression matchExpression,
Object... parameters)
Creates an query that will iterate over all candidates and discriminate all candidates that are not instances of matchinClass> or for which
the boolean matchExpression returns false. |
|
static
|
createMatchQuery(Class<? extends T> matchingClass,
String matchExpression,
Object... parameters)
Parses the matchExpression and creates an query that will iterate over
all candidates and discriminate all candidates that are not instances of
matchinClass> or for which the boolean matchExpression
returns false. |
|
static IQuery<IInstallableUnit> |
createMatchQuery(IExpression matchExpression,
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(String matchExpression,
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
|
createPipeQuery(Collection<? extends IQuery<? extends T>> queries)
Creates a piped query based on the provided input queries. |
|
static
|
createPipeQuery(IQuery<? extends T> query1,
IQuery<? extends T> query2)
Creates a piped query based on the provided input queries. |
|
static
|
createQuery(Class<? extends T> matchingClass,
IExpression expression,
Object... parameters)
Creates a query that will limit the result to instances of the matchinClass . |
|
static
|
createQuery(Class<? extends T> matchingClass,
String expression,
Object... parameters)
Parses the expression and creates a query that will limit the result
to instances of the matchinClass . |
|
static IQuery<IInstallableUnit> |
createQuery(IExpression expression,
Object... parameters)
Creates an IInstallableUnit query based on an expression that
uses all candidates as input. |
|
static IQuery<IInstallableUnit> |
createQuery(String expression,
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final IQuery<IInstallableUnit> ALL_UNITS
public static final String ANY
public static final IQuery<IInstallableUnit> NO_UNITS
public static final String PROP_TYPE_CATEGORY
public static final String PROP_TYPE_GROUP
public static final String PROP_TYPE_PATCH
Constructor Detail |
---|
public QueryUtil()
Method Detail |
---|
public static <T> IQueryable<T> compoundQueryable(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(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
elements
public 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 category
public 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> createIUPropertyQuery(String propertyName, 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 null
public static IQuery<IInstallableUnit> createIUQuery(IVersionedId versionedId)
IInstallableUnit
with the given
id and version.
versionedId
- The precise id/version combination that a matching unit must have
public static IQuery<IInstallableUnit> createIUQuery(String id)
IInstallableUnit
with the given
id, regardless of version.
id
- The installable unit id to match, or null
to match any id
public static IQuery<IInstallableUnit> createIUQuery(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 version
public static IQuery<IInstallableUnit> createIUQuery(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 limit
public static IQuery<IInstallableUnit> createMatchQuery(IExpression matchExpression, 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 substitution
public static IQuery<IInstallableUnit> createMatchQuery(String matchExpression, 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 substitution
public static <T> IQuery<T> createMatchQuery(Class<? extends T> matchingClass, IExpression matchExpression, Object... parameters)
matchinClass>
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 substitution
public static <T> IQuery<T> createMatchQuery(Class<? extends T> matchingClass, String matchExpression, Object... parameters)
matchExpression
and creates an query that will iterate over
all candidates and discriminate all candidates that are not instances of
matchinClass>
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 substitution
public static <T> IQuery<T> createPipeQuery(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 perform
public 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 query
public static IQuery<IInstallableUnit> createQuery(IExpression expression, Object... parameters)
IInstallableUnit
query based on an expression
that
uses all candidates as input.
expression
- The query expressionparameters
- Values for parameter substitution
public static IQuery<IInstallableUnit> createQuery(String expression, 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 substitution
public static <T> IQuery<T> createQuery(Class<? extends T> matchingClass, IExpression expression, Object... parameters)
matchinClass
. 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 substitution
public static <T> IQuery<T> createQuery(Class<? extends T> matchingClass, String expression, Object... parameters)
expression
and creates a query that will limit the result
to instances of the matchinClass
. 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 substitution
public static boolean isCategory(IInstallableUnit iu)
IInstallableUnit
is a category.
iu
- the element being tested.
public static boolean isFragment(IInstallableUnit iu)
IInstallableUnit
is a fragment.
iu
- the element being tested.
public static boolean isGroup(IInstallableUnit iu)
IInstallableUnit
is a group.
iu
- the element being tested.
public static boolean isPatch(IInstallableUnit iu)
IInstallableUnit
is a patch.
iu
- the element being tested.
|
Eclipse Platform Release 3.6 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2010. All rights reserved.