new wolParser().Tokens.putAll(com.snaulx.wolparser.platforms.(buffer.toString()).Parser.addTokens()); 

buffer is a StringBuilder derived from user input. (buffer.toString ()) is the name of the package and I need to convert it so that the Map from the package entered by the user is added to the Map Tokens. How to do it?

  • Try looking towards the java Reflection API. - Viktor Borovlev

1 answer 1

If someone is interested in solving this problem, then I dropped the working code below.

 Parser parser = (Parser) Class.forName("com.snaulx.wolparser.platforms." + buffer.toString() + ".Parser").newInstance(); new wolParser().Tokens.putAll(parser.addTokens());