私はScalaとJavaの相互運用性を活用しています。また、Javaで書かれた同じプロジェクトでクラスをインスタンス化するためにScalaを使用する以下のコードを用意しています。 CommandExecutor
パラメータは、親クラスから継承されます。Scalaがコンストラクタを解決できない
class IdmIdentityServiceImpl extends ServiceImpl with IdmIdentityService {
override def createNativeUserQuery: NativeUserQuery = {
new NativeUserQueryImpl(commandExecutor)
}
}
は私がcannot resolve constructor
NativeUserQueryImpl
はJavaで書かれていたと言うNativeUserQueryImpl
をインスタンス化して、エラーが発生しますが、私は、JavaとScalaの間の相互運用性について読んで、それが動作するはずのように感じてきました。
これはNativeUserQueryImpl
クラスです。これは、そのコンストラクタの1つにCommandExecutor
タイプを取り入れています。このクラスは、flowable-engineライブラリから来ています。
public class NativeUserQueryImpl extends AbstractNativeQuery<NativeUserQuery, User> implements NativeUserQuery {
private static final long serialVersionUID = 1L;
public NativeUserQueryImpl(CommandContext commandContext) {
super(commandContext);
}
public NativeUserQueryImpl(CommandExecutor commandExecutor) {
super(commandExecutor);
}
// results ////////////////////////////////////////////////////////////////
public List<User> executeList(CommandContext commandContext, Map<String, Object> parameterMap, int firstResult, int maxResults) {
return commandContext.getUserEntityManager().findUsersByNativeQuery(parameterMap, firstResult, maxResults);
}
public long executeCount(CommandContext commandContext, Map<String, Object> parameterMap) {
return commandContext.getUserEntityManager().findUserCountByNativeQuery(parameterMap);
}
}
はEDIT:
全エラー
Error:(31, 5) overloaded method constructor NativeUserQueryImpl with alternatives:
(x$1: org.flowable.idm.engine.impl.interceptor.CommandExecutor)org.flowable.idm.engine.impl.NativeUserQueryImpl <and>
(x$1: org.flowable.idm.engine.impl.interceptor.CommandContext)org.flowable.idm.engine.impl.NativeUserQueryImpl
cannot be applied to (org.flowable.engine.impl.interceptor.CommandExecutor)
new NativeUserQueryImpl(commandExecutor)
'commandExecutor'はどこに定義されていますか? – nmat
同じプロジェクトの@nmat – Rafa
親クラスから継承しています。私はこれが含まれている完全なクラスの署名を追加しています。それは 'ServiceImpl'にあります – Rafa