Groovy String return type with instantiation -


this class reading properties file there 2 files config.groovy have method , call.groovy calling method config , expecting return.

config.groovy

class config {  public  methodparse  {       properties properties = new properties()      file propertiesfile = new file('src/main/resources/application.properties')     propertiesfile.withinputstream          {             properties.load(it)         }      string value = properties."$name"     return value     } } 

load.groovy

 def config = new config ()  config.methodparse "environments.local.logfile"  println (config.methodparse()); 

how have load.groovy pass parameter , print received?

ignoring syntax errors try like

    class config     {          public string methodparse (string name)          {              properties properties = new properties()              file propertiesfile = new file('src/main/resources/application.properties')             propertiesfile.withinputstream              {                 properties.load(it)             }              string value = properties."$name"             return value         }     }      def config = new config ()      the_value =config.methodparse("environments.local.logfile")      println (conf_value); 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -