blob: 3dd931aa7f6f5a2d0c840f7034a0c76531c6c635 (
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
40
41
42
43
|
/*******************************************************************************
* Copyright (c) 2011 Sonatype, Inc. 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:
* Sonatype, Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.equinox.internal.p2.director.app;
import java.util.Iterator;
import org.eclipse.equinox.p2.metadata.expression.IExpression;
import org.eclipse.equinox.p2.query.IQuery;
import org.eclipse.equinox.p2.query.IQueryResult;
/*
* This class is used to keep pretty print a normal query using the information passed in.
*/
public class PrettyQuery<T> implements IQuery<T> {
private IQuery<T> decorated;
private String userString;
public PrettyQuery(IQuery<T> toDecorate, String userReadable) {
decorated = toDecorate;
userString = userReadable;
}
public IQueryResult<T> perform(Iterator<T> iterator) {
return decorated.perform(iterator);
}
public IExpression getExpression() {
return decorated.getExpression();
}
public String toString() {
if (userString != null)
return userString;
return decorated.toString();
}
}
|