## grails.util
Class Metadata

    java.lang.Object
      java.util.Dictionary<K,V>
          java.util.Hashtable<Object,Object>
              java.util.Properties
                  grails.util.Metadata

All Implemented Interfaces:
  Serializable, Cloneable, Map<Object,Object>

    public class Metadata

extends Properties

Represents the application Metadata and loading mechanics

Since:
  1.1 Created: Dec 12, 2008
Author:
  Graeme Rocher
See Also:
  Serialized Form

Nested Class Summary
`(package private) static class` `Metadata.FinalReference<T>`

Field Summary
`static String` `APPLICATION_GRAILS_VERSION`
`static String` `APPLICATION_NAME`
`static String` `APPLICATION_VERSION`
`static String` `DEFAULT_SERVLET_VERSION`
`static String` `FILE`
`static String` `SERVLET_VERSION`
`static String` `WAR_DEPLOYED`

Fields inherited from class java.util.Properties
`defaults`

Method Summary
`String` `getApplicationName()`
`String` `getApplicationVersion()`
`static Metadata` `getCurrent()`
`String` `getEnvironment()`
`String` `getGrailsVersion()`
`static Metadata` `getInstance(File file)` Loads and returns a new Metadata object for the given File
`static Metadata` `getInstance(InputStream inputStream)` Loads a Metadata instance from a Reader
`String` `getServletVersion()`
`boolean` `isWarDeployed()`
`Enumeration` `keys()` Overrides, called by the store method.
`void` `persist()` Saves the current state of the Metadata object
`boolean` `propertiesHaveNotChanged()`
`static Metadata` `reload()` Reloads the application metadata
`static void` `reset()` Resets the current state of the Metadata so it is re-read

Methods inherited from class java.util.Properties
`getProperty, getProperty, list, list, load, loadFromXML, propertyNames, save, setProperty, store, storeToXML, storeToXML`

Methods inherited from class java.util.Hashtable
`clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, rehash, remove, size, toString, values`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### FILE

    public static final String FILE

See Also:
  Constant Field Values

### APPLICATION_VERSION

    public static final String APPLICATION_VERSION

See Also:
  Constant Field Values

### APPLICATION_NAME

    public static final String APPLICATION_NAME

See Also:
  Constant Field Values

### APPLICATION_GRAILS_VERSION

    public static final String APPLICATION_GRAILS_VERSION

See Also:
  Constant Field Values

### SERVLET_VERSION

    public static final String SERVLET_VERSION

See Also:
  Constant Field Values

### WAR_DEPLOYED

    public static final String WAR_DEPLOYED

See Also:
  Constant Field Values

### DEFAULT_SERVLET_VERSION

    public static final String DEFAULT_SERVLET_VERSION

See Also:
  Constant Field Values

Method Detail

### reset

    public static void reset()

  Resets the current state of the Metadata so it is re-read

### getCurrent

    public static Metadata getCurrent()

  Returns:
    Returns the metadata for the current application

### getInstance

    public static Metadata getInstance(InputStream inputStream)

  Loads a Metadata instance from a Reader

  Parameters:
    `inputStream` - The InputStream
  Returns:
    a Metadata instance

### getInstance

    public static Metadata getInstance(File file)

  Loads and returns a new Metadata object for the given File

  Parameters:
    `file` - The File
  Returns:
    A Metadata object

### reload

    public static Metadata reload()

  Reloads the application metadata

  Returns:
    The metadata object

### getApplicationVersion

    public String getApplicationVersion()

  Returns:
    The application version

### getGrailsVersion

    public String getGrailsVersion()

  Returns:
    The Grails version used to build the application

### getEnvironment

    public String getEnvironment()

  Returns:
    The environment the application expects to run in

### getApplicationName

    public String getApplicationName()

  Returns:
    The application name

### getServletVersion

    public String getServletVersion()

  Returns:
    The version of the servlet spec the application was created for

### persist

    public void persist()

  Saves the current state of the Metadata object

### propertiesHaveNotChanged

    public boolean propertiesHaveNotChanged()

  Returns:
    Returns true if these properties have not changed since they were loaded

### keys

    public Enumeration keys()

  Overrides, called by the store method.

  Overrides:
    `keys` in class `Hashtable<Object,Object>`

### isWarDeployed

    public boolean isWarDeployed()

  Returns:
    Returns true if this application is deployed as a WAR

Copyright (c) 2005-2009 The Grails project