dimanche 21 décembre 2014

scala override static java method

I am trying to use Webgraph http://ift.tt/1hYBsC4 framework in Scala. Here exists some posibility to customize Loader classes. This customization was made via reflection.


... graphClass = Class.forName( graphClassName ); // graphClassName string name of class graph = (ImmutableGraph)graphClass.getMethod( "load", InputStream.class ).invoke( null, is ); ...


in java "load" is static method of class , but how can i write this method on scala to allow my code work ? I have tried



class MyLoader {
def load(filename:String,progressLoader:ProgressLoader ) = ...
}


or even



object MyLoader {
def load(filename:String,progressLoader:ProgressLoader ) = ...
}


with graphClassName = "MyLoader$"


but without success.






Aucun commentaire:

Enregistrer un commentaire