Groovy Documentation

## grails.util
[Java] Class Metadata

    java.lang.Object
      java.util.Dictionary
          java.util.Hashtable
              java.util.Properties
                  grails.util.Metadata

    public class Metadata
    extends java.util.Properties

Represents the application Metadata and loading mechanics.

Authors:
  Graeme Rocher

Since:
  1.1

Field Summary
`static java.lang.String` | `APPLICATION_GRAILS_VERSION`
`static java.lang.String` | `APPLICATION_NAME`
`static java.lang.String` | `APPLICATION_VERSION`
`static java.lang.String` | `DEFAULT_SERVLET_VERSION`
`static java.lang.String` | `FILE`
`static java.lang.String` | `SERVLET_VERSION`
`static java.lang.String` | `WAR_DEPLOYED`

Method Summary
`java.lang.String` | `getApplicationName()` @return The application name
`java.lang.String` | `getApplicationVersion()` @return The application version
`static Metadata` | `getCurrent()` @return the metadata for the current application
`java.lang.String` | `getEnvironment()` @return The environment the application expects to run in
`java.lang.String` | `getGrailsVersion()` @return The Grails version used to build the application
`java.util.Map` | `getInstalledPlugins()` Obtains a map (name->version) of installed plugins specified in the project metadata
`static Metadata` | `getInstance(java.io.InputStream inputStream)` Loads a Metadata instance from a Reader
`static Metadata` | `getInstance(java.io.File file)` Loads and returns a new Metadata object for the given File.
`java.lang.String` | `getServletVersion()` @return The version of the servlet spec the application was created for
`boolean` | `isWarDeployed()` @return true if this application is deployed as a WAR
`java.util.Enumeration` | `keys()` Overrides, called by the store method.
`void` | `persist()` Saves the current state of the Metadata object.
`boolean` | `propertiesHaveNotChanged()` @return Returns true if these properties have not changed since they were loaded
`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

java.util.Properties#setProperty(java.lang.String, java.lang.String), java.util.Properties#getProperty(java.lang.String, java.lang.String), java.util.Properties#getProperty(java.lang.String), java.util.Properties#load(java.io.Reader), java.util.Properties#load(java.io.InputStream), java.util.Properties#list(java.io.PrintStream), java.util.Properties#list(java.io.PrintWriter), java.util.Properties#save(java.io.OutputStream, java.lang.String), java.util.Properties#store(java.io.Writer, java.lang.String), java.util.Properties#store(java.io.OutputStream, java.lang.String), java.util.Properties#loadFromXML(java.io.InputStream), java.util.Properties#storeToXML(java.io.OutputStream, java.lang.String, java.lang.String), java.util.Properties#storeToXML(java.io.OutputStream, java.lang.String), java.util.Properties#propertyNames(), java.util.Properties#stringPropertyNames(), java.util.Properties#get(java.lang.Object), java.util.Properties#put(java.lang.Object, java.lang.Object), java.util.Properties#equals(java.lang.Object), java.util.Properties#toString(), java.util.Properties#values(), java.util.Properties#hashCode(), java.util.Properties#clone(), java.util.Properties#clear(), java.util.Properties#isEmpty(), java.util.Properties#contains(java.lang.Object), java.util.Properties#size(), java.util.Properties#entrySet(), java.util.Properties#putAll(java.util.Map), java.util.Properties#remove(java.lang.Object), java.util.Properties#elements(), java.util.Properties#keys(), java.util.Properties#keySet(), java.util.Properties#containsValue(java.lang.Object), java.util.Properties#containsKey(java.lang.Object), java.util.Properties#wait(), java.util.Properties#wait(long), java.util.Properties#wait(long, int), java.util.Properties#getClass(), java.util.Properties#notify(), java.util.Properties#notifyAll()

Methods inherited from class java.util.Hashtable

java.util.Hashtable#get(java.lang.Object), java.util.Hashtable#put(java.lang.Object, java.lang.Object), java.util.Hashtable#equals(java.lang.Object), java.util.Hashtable#toString(), java.util.Hashtable#values(), java.util.Hashtable#hashCode(), java.util.Hashtable#clone(), java.util.Hashtable#clear(), java.util.Hashtable#isEmpty(), java.util.Hashtable#contains(java.lang.Object), java.util.Hashtable#size(), java.util.Hashtable#entrySet(), java.util.Hashtable#putAll(java.util.Map), java.util.Hashtable#remove(java.lang.Object), java.util.Hashtable#elements(), java.util.Hashtable#keys(), java.util.Hashtable#keySet(), java.util.Hashtable#containsValue(java.lang.Object), java.util.Hashtable#containsKey(java.lang.Object), java.util.Hashtable#wait(), java.util.Hashtable#wait(long), java.util.Hashtable#wait(long, int), java.util.Hashtable#getClass(), java.util.Hashtable#notify(), java.util.Hashtable#notifyAll()

Methods inherited from class java.util.Dictionary

java.util.Dictionary#get(java.lang.Object), java.util.Dictionary#put(java.lang.Object, java.lang.Object), java.util.Dictionary#isEmpty(), java.util.Dictionary#size(), java.util.Dictionary#remove(java.lang.Object), java.util.Dictionary#elements(), java.util.Dictionary#keys(), java.util.Dictionary#wait(), java.util.Dictionary#wait(long), java.util.Dictionary#wait(long, int), java.util.Dictionary#equals(java.lang.Object), java.util.Dictionary#toString(), java.util.Dictionary#hashCode(), java.util.Dictionary#getClass(), java.util.Dictionary#notify(), java.util.Dictionary#notifyAll()

Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### APPLICATION_GRAILS_VERSION

    public static final java.lang.String APPLICATION_GRAILS_VERSION

### APPLICATION_NAME

    public static final java.lang.String APPLICATION_NAME

### APPLICATION_VERSION

    public static final java.lang.String APPLICATION_VERSION

### DEFAULT_SERVLET_VERSION

    public static final java.lang.String DEFAULT_SERVLET_VERSION

### FILE

    public static final java.lang.String FILE

### SERVLET_VERSION

    public static final java.lang.String SERVLET_VERSION

### WAR_DEPLOYED

    public static final java.lang.String WAR_DEPLOYED

Method Detail

### getApplicationName

    public java.lang.String getApplicationName()

  Returns:
    The application name

### getApplicationVersion

    public java.lang.String getApplicationVersion()

  Returns:
    The application version

### getCurrent

    public static Metadata getCurrent()

  Returns:
    the metadata for the current application

### getEnvironment

    public java.lang.String getEnvironment()

  Returns:
    The environment the application expects to run in

### getGrailsVersion

    public java.lang.String getGrailsVersion()

  Returns:
    The Grails version used to build the application

### getInstalledPlugins

    public java.util.Map getInstalledPlugins()

  Obtains a map (name->version) of installed plugins specified in the project metadata
  Returns:
    A map of installed plugins

### getInstance

    public static Metadata getInstance(java.io.InputStream inputStream)

  Loads a Metadata instance from a Reader
  Parameters:
    `inputStream` - The InputStream
  Returns:
    a Metadata instance

### getInstance

    public static Metadata getInstance(java.io.File file)

  Loads and returns a new Metadata object for the given File.
  Parameters:
    `file` - The File
  Returns:
    A Metadata object

### getServletVersion

    public java.lang.String getServletVersion()

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

### isWarDeployed

    public boolean isWarDeployed()

  Returns:
    true if this application is deployed as a WAR

### keys

    @Override
    @SuppressWarnings({"unchecked","rawtypes"})
    public java.util.Enumeration keys()

  Overrides, called by the store method.

### 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

### reload

    public static Metadata reload()

  Reloads the application metadata.
  Returns:
    The metadata object

### reset

    public static void reset()

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

Groovy Documentation