I’m trying to convert the following Java code into Scala:
ImageRecognitionPlugin imageRecognition = (ImageRecognitionPlugin)nnet.getPlugin(ImageRecognitionPlugin.class)
It runs in Java (full code: http://neuroph.sourceforge.net/image_recognition.html).
What would it be in Scala? I’m confused about the “(ImageRecognitionPlugin).nnet” bit and I get the following error when I drop the “(ImageRecognitionPlugin)“.
“error: object ImageRecognitionPlugin is not a value”
In scala you need to specify whether you are create a mutable (var) or immutable (val) variable. You also need to use classOf and instanceOf instead of .class and the (cast):