blob: d1035cf2006c7292fc0d52a5e5804229a8ddb527 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/*******************************************************************************
* Copyright (c) 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Cloudsmith Inc. - converted into expression based query
*******************************************************************************/
package org.eclipse.equinox.p2.metadata.query;
import org.eclipse.equinox.internal.p2.metadata.query.IUPropertyQuery;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
/**
* A query matching every {@link IInstallableUnit} that is a group.
* @since 2.0
*/
public final class GroupQuery extends ExpressionQuery<IInstallableUnit> {
private static final String PROP_TYPE_GROUP = "org.eclipse.equinox.p2.type.group"; //$NON-NLS-1$
public GroupQuery() {
super(IInstallableUnit.class, IUPropertyQuery.createMatchExpression(PROP_TYPE_GROUP, Boolean.TRUE.toString()));
}
/**
* Test if the {@link IInstallableUnit} is a group.
* @param iu the element being tested.
* @return <tt>true</tt> if the parameter is a group.
*/
public static boolean isGroup(IInstallableUnit iu) {
String value = iu.getProperty(PROP_TYPE_GROUP);
if (value != null && (value.equals(Boolean.TRUE.toString())))
return true;
return false;
}
}
|