Make portions of ListChanges public
This enables other callers to use ListChanges, for example a plugin might want to drive ListChanges with their own arguments without going through the args4j option parser. Change-Id: I5cfd342673e9e381079b2c1891fe73e48be3e93b
This commit is contained in:
@@ -38,6 +38,14 @@ public enum ListChangesOption {
|
|||||||
this.value = v;
|
this.value = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ListChangesOption fromValue(int value) {
|
||||||
|
return ListChangesOption.values()[value];
|
||||||
|
}
|
||||||
|
|
||||||
public static EnumSet<ListChangesOption> fromBits(int v) {
|
public static EnumSet<ListChangesOption> fromBits(int v) {
|
||||||
EnumSet<ListChangesOption> r = EnumSet.noneOf(ListChangesOption.class);
|
EnumSet<ListChangesOption> r = EnumSet.noneOf(ListChangesOption.class);
|
||||||
for (ListChangesOption o : ListChangesOption.values()) {
|
for (ListChangesOption o : ListChangesOption.values()) {
|
||||||
|
@@ -124,12 +124,12 @@ public class ListChanges {
|
|||||||
private List<String> queries;
|
private List<String> queries;
|
||||||
|
|
||||||
@Option(name = "--limit", aliases = {"-n"}, metaVar = "CNT", usage = "Maximum number of results to return")
|
@Option(name = "--limit", aliases = {"-n"}, metaVar = "CNT", usage = "Maximum number of results to return")
|
||||||
void setLimit(int limit) {
|
public void setLimit(int limit) {
|
||||||
imp.setLimit(limit);
|
imp.setLimit(limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Option(name = "-o", multiValued = true, usage = "Output options per change")
|
@Option(name = "-o", multiValued = true, usage = "Output options per change")
|
||||||
void addOption(ListChangesOption o) {
|
public void addOption(ListChangesOption o) {
|
||||||
options.add(o);
|
options.add(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ public class ListChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Option(name = "-P", metaVar = "SORTKEY", usage = "Previous changes before SORTKEY")
|
@Option(name = "-P", metaVar = "SORTKEY", usage = "Previous changes before SORTKEY")
|
||||||
void setSortKeyAfter(String key) {
|
public void setSortKeyAfter(String key) {
|
||||||
// Querying for the prior page of changes requires sortkey_after predicate.
|
// Querying for the prior page of changes requires sortkey_after predicate.
|
||||||
// Changes are shown most recent->least recent. The previous page of
|
// Changes are shown most recent->least recent. The previous page of
|
||||||
// results contains changes that were updated after the given key.
|
// results contains changes that were updated after the given key.
|
||||||
@@ -148,7 +148,7 @@ public class ListChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Option(name = "-N", metaVar = "SORTKEY", usage = "Next changes after SORTKEY")
|
@Option(name = "-N", metaVar = "SORTKEY", usage = "Next changes after SORTKEY")
|
||||||
void setSortKeyBefore(String key) {
|
public void setSortKeyBefore(String key) {
|
||||||
// Querying for the next page of changes requires sortkey_before predicate.
|
// Querying for the next page of changes requires sortkey_before predicate.
|
||||||
// Changes are shown most recent->least recent. The next page contains
|
// Changes are shown most recent->least recent. The next page contains
|
||||||
// changes that were updated before the given key.
|
// changes that were updated before the given key.
|
||||||
@@ -193,6 +193,14 @@ public class ListChanges {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ListChanges addQuery(String query) {
|
||||||
|
if (queries == null) {
|
||||||
|
queries = Lists.newArrayList();
|
||||||
|
}
|
||||||
|
queries.add(query);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public void query(Writer out)
|
public void query(Writer out)
|
||||||
throws OrmException, QueryParseException, IOException {
|
throws OrmException, QueryParseException, IOException {
|
||||||
if (imp.isDisabled()) {
|
if (imp.isDisabled()) {
|
||||||
|
Reference in New Issue
Block a user