Skip to content

Commit

Permalink
Log class name instead of requiring implementation from all children
Browse files Browse the repository at this point in the history
  • Loading branch information
avarsava committed Apr 23, 2024
1 parent d739767 commit 9b93bfa
Show file tree
Hide file tree
Showing 19 changed files with 4 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,6 @@ protected Stream<Issue> fetch(String jql, Instant lastUpdated)
throws URISyntaxException, IOException, InterruptedException {
return search(jql, FIELDS).stream();
}

@Override
protected String getKType() {
return "String";
}

@Override
protected String getVType() {
return "Stream<Issue>";
}
}

static class JiraActionFilter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,6 @@ public synchronized Optional<Integer> update(Configuration configuration) {
protected Optional<Object> fetch(Tuple key, Instant lastUpdated) {
return Optional.of(function.apply(definer.get().connection.get(), key));
}

@Override
protected String getKType() {
return "Tuple";
}

@Override
protected String getVType() {
return "Optional<Object>";
}
};

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,6 @@ protected Optional<AlgebraicValue> fetch(Pair<Path, Boolean> fileName, Instant l
throw e;
}
}

@Override
protected String getKType() {
return "Pair<Path, Boolean>";
}

@Override
protected String getVType() {
return "Optional<AlgebraicValue>";
}
}

static final ObjectMapper MAPPER = new ObjectMapper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,6 @@ protected Optional<Tuple> fetch(String id, Instant lastUpdated) throws Exception
}
return Optional.empty();
}

@Override
protected String getKType() {
return "String";
}

@Override
protected String getVType() {
return "Optional<Tuple>";
}
}

private static final Imyhat EXTERNAL_KEY_TYPE =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,7 @@ public final void ttl(int ttl) {
public String toString() {
StringBuilder writeOut = new StringBuilder();
writeOut
.append("KeyValueCache of types ")
.append(getKType())
.append(" and ")
.append(getVType())
.append(this.getClass())
.append(" with CACHES = ")
.append(CACHES.entrySet())
.append(", maxCount = ")
Expand All @@ -191,8 +188,4 @@ public String toString() {
.append(ttl);
return writeOut.toString();
}

protected abstract String getKType();

protected abstract String getVType();
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,4 @@ protected <F> F convert(
ActionFilterBuilder<F, ActionState, String, Instant, Long> filterBuilder) {
return filterBuilder.added(start, end);
}

@Override
protected String getName() {
return "Last generated by olive";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,4 @@ protected <F> F convert(
long offset, ActionFilterBuilder<F, ActionState, String, Instant, Long> filterBuilder) {
return filterBuilder.addedAgo(offset);
}

@Override
protected String getOperation() {
return "Last generated by olive (ago)";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,4 @@ public <F> F convert(
ActionFilterBuilder<F, ActionState, String, Instant, Long> filterBuilder, Stream<F> filters) {
return filterBuilder.and(filters);
}

@Override
protected String getOperation() {
return "AND";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,4 @@ public <F> F convert(
long offset, ActionFilterBuilder<F, ActionState, String, Instant, Long> filterBuilder) {
return filterBuilder.checkedAgo(offset);
}

@Override
protected String getOperation() {
return "Last run by scheduler (ago)";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,4 @@ public <F> F convert(
ActionFilterBuilder<F, ActionState, String, Instant, Long> filterBuilder) {
return filterBuilder.checked(start, end);
}

@Override
protected String getName() {
return "created";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,4 @@ public <F> F convert(
long offset, ActionFilterBuilder<F, ActionState, String, Instant, Long> filterBuilder) {
return filterBuilder.createdAgo(offset);
}

@Override
protected String getOperation() {
return "created (ago)";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,4 @@ public <F> F convert(
ActionFilterBuilder<F, ActionState, String, Instant, Long> filterBuilder) {
return filterBuilder.external(start, end);
}

@Override
protected String getName() {
return "External Modification";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,4 @@ public <F> F convert(
long offset, ActionFilterBuilder<F, ActionState, String, Instant, Long> filterBuilder) {
return filterBuilder.externalAgo(offset);
}

@Override
protected String getOperation() {
return "External Modification (ago)";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,4 @@ public <F> F convert(
ActionFilterBuilder<F, ActionState, String, Instant, Long> filterBuilder, Stream<F> filters) {
return filterBuilder.or(filters);
}

@Override
protected String getOperation() {
return "OR";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,4 @@ public <F> F convert(
ActionFilterBuilder<F, ActionState, String, Instant, Long> filterBuilder) {
return filterBuilder.statusChanged(start, end);
}

@Override
protected String getName() {
return "last state change";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,4 @@ public <F> F convert(
long offset, ActionFilterBuilder<F, ActionState, String, Instant, Long> filterBuilder) {
return filterBuilder.statusChangedAgo(offset);
}

@Override
protected String getOperation() {
return "Last status change";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ public final void setOffset(long offset) {
@Override
public String toString() {
StringBuilder writeOut = new StringBuilder();
writeOut.append(getOperation()).append(" filter of offset: ").append(offset);
writeOut.append(this.getClass()).append(" type filter of offset: ").append(offset);
return writeOut.toString();
}

protected abstract String getOperation();
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@ public String toString() {
StringBuilder writeOut = new StringBuilder();
writeOut
.append("Collection Action Filter (")
.append(getOperation())
.append(this.getClass())
.append(" of: ")
.append(Arrays.toString(filters));
return writeOut.toString();
}

protected abstract String getOperation();
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,12 @@ public final void setStart(Long start) {
this.start = start;
}

protected abstract String getName();

@Override
public String toString() {
StringBuilder writeOut = new StringBuilder();
writeOut
.append("Range filter of type: ")
.append(getName())
.append(this.getClass())
.append(" between ")
.append(start)
.append(" and ")
Expand Down

0 comments on commit 9b93bfa

Please sign in to comment.