Skip to content

Commit ff0b696

Browse files
committed
CallingOps: add note on inType/outType
1 parent 19a6013 commit ff0b696

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/ops/doc/CallingOps.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ gaussOp.compute(inImage, 2.0, outImage)
5555

5656
*Note that the default `OpEnvironment` implementations cache Op requests* - this means that repeated `OpBuilder` requests targeting the same action will be faster than the original matching call.
5757

58+
## Additions: Matching with classes
59+
60+
In addition to the `.input()` and `.output()` builder steps, there are parallel `.inType()` and `.outType()`
61+
methods. These accept either a `Class` or a `Nil` - the latter allowing retention of generic types.
62+
63+
```groovy
64+
var computer = ops.op("filter.gauss").inType(ImgPlus.class, Double.class).outType(ImgPlus.class).computer()
65+
```
66+
67+
When using the `*Type` methods of the builder, the terminal steps will only allow *creation* of the Op, not
68+
direct execution, since the parameters have not been concretely specified yet.
69+
5870
## Common Pitfalls: Wildcards
5971

6072
Using [wildcards](https://docs.oracle.com/javase/tutorial/extra/generics/wildcards.html), such as `Img<?> inImage`, can make Op reuse difficult. For example, the following code segment will not compile in a Java runtime:

0 commit comments

Comments
 (0)