imagej / imagej/imagej-ops

Optional input parameter type

Open
#118 2 comments 0 reactions 1 assignee Claimed by @ctrueden View on GitHub
2016-07-hackathon matching
Dominant language
Java
Stars
94
Forks
44
PR merge metrics
No merged PRs in 30d

Description

I wrote the following Op:

``` java
@Plugin(type = Op.class, name = "bugop")
public class BugOp & NativeType> implements
OutputOp {

// optional input
@Parameter(type = ItemIO.INPUT, required = false)
private T type;

@Parameter(type = ItemIO.OUTPUT)
private Object output;

@Override
public void run() {
if (type == null) {
output = null;
} else {
output = new Object();
}
}

@Override
public Object getOutput() {
return output;
}

@Override
public void setOutput(Object output) {
this.output = output;
}
}
```

If I call this Op with new DoubleType() as input argument the input parameter "type" in my Op is still null and therefore my output equals null.

``` java
Object output = ops.run(BugOp.class, new DoubleType());
```

Why is the parameter "type" still null?

If I write

``` java
private DoubleType type
```

instead of

``` java
private T type
```

everything works fine.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.