英文:
Conflicting implementations detected with new Command
问题
我使用Pousse-Café框架,在创建新命令后开始出现运行时错误。
当我尝试执行测试时,我得到了这个错误:
poussecafe.exception.PousseCafeException: 检测到消息接口sbf.iboost.supplychain.model.command.UpdateAvailablity的冲突实现
在所有需要Pousse-Café运行时的测试中。
以下是命令部分:
@MessageImplementation(message = UpdateAvailablity.class)
public interface UpdateAvailablity extends Command {
Attribute<UserId> id();
Attribute<Boolean> availablity();
}
以及其实现部分:
@SuppressWarnings("serial")
@MessageImplementation(message = UpdateAvailablity.class)
public class UpdateAvailablityData implements Serializable, UpdateAvailablity {
@Override
public Attribute<UserId> id() {
return AttributeBuilder
.stringId(UserId.class)
.read(() -> id)
.write(value -> id = value)
.build();
}
private String id;
@Override
public Attribute<Boolean> availablity() {
return AttributeBuilder
.single(Boolean.class)
.read(() -> availablity)
.write(value -> availablity = value)
.build();
}
private boolean availablity;
}
请注意,由于您要求只返回翻译的部分,我已删除了您提供的原始文本以外的所有内容。如果您需要进一步的帮助,请随时提问。
英文:
I use Pousse-Café framework and started to have a runtime error after creating a new command.
When I try to execute my tests, I get this error:
poussecafe.exception.PousseCafeException: Conflicting implementations detected for message interface sbf.iboost.supplychain.model.command.UpdateAvailablity
in all tests requiring a Pousse-Café runtime.
Here is the command:
@MessageImplementation(message = UpdateAvailablity.class)
public interface UpdateAvailablity extends Command {
Attribute<UserId> id();
Attribute<Boolean> availablity();
}
and its implementation:
@SuppressWarnings("serial")
@MessageImplementation(message = UpdateAvailablity.class)
public class UpdateAvailablityData implements Serializable, UpdateAvailablity {
@Override
public Attribute<UserId> id() {
return AttributeBuilder
.stringId(UserId.class)
.read(() -> id)
.write(value -> id = value)
.build();
}
private String id;
@Override
public Attribute<Boolean> availablity() {
return AttributeBuilder
.single(Boolean.class)
.read(() -> availablity)
.write(value -> availablity = value)
.build();
}
private boolean availablity;
}
答案1
得分: 1
问题实际上源于 @MessageImplementation
注解同时用于命令的定义(UpdateAvailablity
类)和实现(UpdateAvailablityData
类)。它应仅出现在实现上。在定义上移除该注解解决了这个问题。
英文:
The problem is actually coming from the fact that @MessageImplementation
annotation is used on both the definition (UpdateAvailablity
class) and the implementation (UpdateAvailablityData
class) of the command. It should only be present on the implementation. Removing the annotation on the definition solved the problem.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论