(Quick Reference)

5.6.1 Metadata - Reference Documentation

Authors: Andres Almiray

Version: 1.2.0

5.6.1 Metadata

Access to the application's metadata file (application.properties) is available by querying the griffon.util.Metadata singleton. Here's a snippet of code that shows how to setup a welcome message that displays the application's name and version, along with its Griffon version

import griffon.util.Metadata

def meta = Metadata.current application(title: "Some app", package: true) { gridLayout cols: 1, rows: 2 label "Hello, I'm ${meta['app.name']}-${meta['app.version']}" label "Built with Griffon ${meta['app.griffon.version']}" }

There are also a few helpful methods on this class

  • getApplicationName() - same result as meta['app.name']
  • getApplicationVersion() - same result as meta['app.version']
  • getApplicationToolkit() - same result as meta['app.toolkit']
  • getGriffonVersion() - same result as meta['app.griffon.version']
  • getGriffonStartDir() - returns the value of 'griffon.start.dir' from the System properties
  • getGriffonWorkingDir() - returns a File that points to 'griffon.start.dir' if the value is set and the file is writable, otherwise returns a File pointing to the current location if it is writable; if that fails then attempts to return a File pointing to 'user.dir'; if all fail it will return the location to a temporal file, typically '/tmp/${griffonAppName}'.