Hello,

I extended my GradleConfigurationClass and now I get NPE - so it looks like 
things don't work that way, I thought they would ...

My Config-class is this: 
-----------<snip>---------------
class SRProjectTypes {
   private final String LibraryType        = 'lib'
   private final String ProcessType      = 'process'
   private final String ServiceType       = 'service'
   private final String ApplicationType = 'application'
   private final String ThemeType        = 'theme'
   private final String StandaloneType = 'standalone'
   def project
   def targetSubDir = [
      LibraryType        : 'lib',
      ProcessType      : 'ext',
      ServiceType       : 'srv',
      ApplicationType : 'ext',
      ThemeType        : 'ext',
      StandaloneType : '.'
   ]
   
   def srLibraries() {
      project.subprojects.findAll { typeOf(it.name) == LibraryType }
   }
   def srProcesses() {
      project.subprojects.findAll { typeOf(it.name) == ProcessType }
   }
   def srServices() {
      project.subprojects.findAll { typeOf(it.name) == ServiceType }
   }
   def srApplications() {
      project.subprojects.findAll { typeOf(it.name) == ApplicationType }
   }
   def srThemes() {
      project.subprojects.findAll { typeOf(it.name) == ThemeType }
   }
   def srStandalones() {
      project.subprojects.findAll { typeOf(it.name) == StandaloneType }
   }

   def typeOf(String name) {
      if (name.endsWith('Process')) return ProcessType
      if (name.startsWith('SRSrv')) return ServiceType
      if (name.startsWith('SRApp')) return ApplicationType
      if (name.startsWith('SRTheme')) return ThemeType
      if (name == 'SRStarter'
       || name == 'SRJInstaller'
       || name == 'SRServiceManager') return StandaloneType
      return LibraryType
   }
}
-----------<snap>---------------

Later in the build script I use that class:

-----------<snip>---------------
File targetBase = ...

for (file in configurations.runtime) {
   type = typeOf(file.name)
   targetDir = new File(targetBase, targetSubDir[type])
...
}
-----------<snap>---------------

From the NPE I guess, that at definition of the map, the keys get not 
dereferenced, so I'm asking for nonexisting keys.
How can I define the map, so that the keys of the map are the values and not 
the names of the defined keys (from above)?

Is the access-pattern ok for that map, or do I have errors at both edges?

kind regards

Geronimo

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to