Skip to content

Commit

Permalink
remove default values for @Batch annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
geomagilles committed Sep 29, 2024
1 parent bc16c33 commit 45609dc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ package io.infinitic.annotations

/** Use this annotation to define a timeout duration for tasks */
@Target(AnnotationTarget.FUNCTION)
annotation class Batch(val maxMessage: Int = 100, val maxDelaySeconds: Double = 1.0)
annotation class Batch(val maxMessage: Int, val maxDelaySeconds: Double)
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
/**
/*
* "Commons Clause" License Condition v1.0
* <p>
*
* The Software is provided to you by the Licensor under the License, as defined below, subject to
* the following condition.
* <p>
*
* Without limiting other conditions in the License, the grant of rights under the License will not
* include, and the License does not grant to you, the right to Sell the Software.
* <p>
*
* For purposes of the foregoing, “Sell” means practicing any or all of the rights granted to you
* under the License to provide to third parties, for a fee or other consideration (including
* without limitation fees for hosting or consulting/ support services related to the Software), a
* product or service whose value derives, entirely or substantially, from the functionality of the
* Software. Any license notice or attribution required by the License must also include this
* Commons Clause License Condition notice.
* <p>
*
* Software: Infinitic
* <p>
*
* License: MIT License (https://opensource.org/licenses/MIT)
* <p>
*
* Licensor: infinitic.io
*/

package io.infinitic.common.utils.java;

import io.infinitic.annotations.Batch;

import java.util.Arrays;
import java.util.List;
import java.util.Set;

// 1 parameter - Batched method with Collection parameter
@SuppressWarnings("ALL")
class FooBatch1 {
public String bar(int p) {
return Integer.toString(p);
}

@Batch
@Batch(maxMessage = 10, maxDelaySeconds = 1.0)
public List<String> bar(List<Integer> p) {
return p.stream().map(Object::toString).toList();
}
Expand All @@ -47,9 +46,9 @@ public String bar(int p) {
return Integer.toString(p);
}

@Batch
@Batch(maxMessage = 10, maxDelaySeconds = 1.0)
public List<String> bar(int... p) {
return java.util.Arrays.stream(p).mapToObj(Integer::toString).toList();
return Arrays.stream(p).mapToObj(Integer::toString).toList();
}
}

Expand All @@ -59,7 +58,7 @@ public String bar(int p, int q) {
return Integer.toString(p) + q;
}

@Batch
@Batch(maxMessage = 10, maxDelaySeconds = 1.0)
public List<String> bar(List<PairInt> l) {
return l.stream().map(pair -> bar(pair.p(), pair.q())).toList();
}
Expand All @@ -71,9 +70,9 @@ public String bar(int p, int q) {
return Integer.toString(p) + q;
}

@Batch
@Batch(maxMessage = 10, maxDelaySeconds = 1.0)
public List<String> bar(PairInt... l) {
return java.util.Arrays.stream(l).map(pair -> bar(pair.p(), pair.q())).toList();
return Arrays.stream(l).map(pair -> bar(pair.p(), pair.q())).toList();
}
}

Expand All @@ -83,7 +82,7 @@ public String bar(Set<Integer> p) {
return p.toString();
}

@Batch
@Batch(maxMessage = 10, maxDelaySeconds = 1.0)
public List<String> bar(List<Set<Integer>> p) {
return p.stream().map(Set::toString).toList();
}
Expand All @@ -95,7 +94,7 @@ public void bar(int p, int q) {
// do nothing
}

@Batch
@Batch(maxMessage = 10, maxDelaySeconds = 1.0)
public void bar(List<PairInt> p) {
// do nothing
}
Expand All @@ -107,7 +106,7 @@ public void bar(MyPair<Integer> pair) {
// do nothing
}

@Batch
@Batch(maxMessage = 10, maxDelaySeconds = 1.0)
public void bar(List<MyPair<Integer>> pairs) {
// do nothing
}
Expand All @@ -119,7 +118,7 @@ public String bar(int p) {
return Integer.toString(p);
}

@Batch
@Batch(maxMessage = 10, maxDelaySeconds = 1.0)
public List<String> bar(List<Integer> p, int q) {
return p.stream().map(Object::toString).toList();
}
Expand All @@ -131,7 +130,7 @@ public String bar(int p, int q) {
return Integer.toString(p) + q;
}

@Batch
@Batch(maxMessage = 10, maxDelaySeconds = 1.0)
public List<String> bar(List<Integer> p) {
return p.stream().map(Object::toString).toList();
}
Expand All @@ -143,14 +142,14 @@ public String bar(int p, int q) {
return Integer.toString(p) + q;
}

@Batch
@Batch(maxMessage = 10, maxDelaySeconds = 1.0)
public List<String> bar(List<PairInt> p) {
return p.stream().map(Object::toString).toList();
}

@Batch
@Batch(maxMessage = 10, maxDelaySeconds = 1.0)
public List<String> bar(PairInt... p) {
return java.util.Arrays.stream(p).map(Object::toString).toList();
return Arrays.stream(p).map(Object::toString).toList();
}
}

Expand All @@ -160,7 +159,7 @@ public String bar(int p, int q) {
return "?";
}

@Batch
@Batch(maxMessage = 10, maxDelaySeconds = 1.0)
public List<Integer> bar(List<PairInt> p) {
return p.stream().map(pair -> pair.p() + pair.q()).toList();
}
Expand All @@ -172,7 +171,7 @@ public String bar(int p, int q) {
return "?";
}

@Batch
@Batch(maxMessage = 10, maxDelaySeconds = 1.0)
public String bar(List<PairInt> p) {
return "?";
}
Expand Down

0 comments on commit 45609dc

Please sign in to comment.