Open nemo83 opened 1 week ago
@nemo83 Currently @Constr
annotation can only be applied to a class not interface. So in this case, you need to do something like this.
public interface MyOptional {
}
@Constr
public class Some implements MyOptional {
private BigInteger value;
public BigInteger getValue() {
return value;
}
public void setValue(BigInteger value) {
this.value = value;
}
}
@Constr(alternative = 1)
public class None implements MyOptional {
}
What if you MyOption
appears in another model object?
EDIT:
By converting MyOption
from interface
to abstract class
seemed to have done the trick.
Anyway, blueprint seems to be able to handle @Constr
at interface level when for example you have a Redeemer
which can be something like
pub type Redeemer {
Withdraw,
Spend(something: Int)
}
The auto generated code is already:
@Constr
public interface Redeemer {
}
I'm not sure if I'm doing something wrong, but
Given an interface and two class implementations, one empty class and one class w/ one property (as per MyOptional example) https://github.com/bloxbean/cardano-client-lib/blob/fix/blueprint-sum-type-annotation/annotation-processor/src/test/java/com/bloxbean/cardano/client/plutus/annotation/processor/model/MyOptional.java
The code that is autogenerated has error.