Package: grails.util

## [Groovy] Class Metadata

- grails.util.Metadata

-     @groovy.transform.CompileStatic
      class Metadata
      extends io.micronaut.context.env.PropertySourcePropertyResolver

  Represents the application Metadata and loading mechanics.

  Authors:
    Graeme Rocher
  Since:
    1.1

- - ### Nested Class Summary

    Nested classes
    Modifiers | Name | Description
    --- | --- | ---
    `static class` | `Metadata.FinalReference` |

  - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static java.lang.String` | `APPLICATION_GRAILS_VERSION` |
    `static java.lang.String` | `APPLICATION_NAME` |
    `static java.lang.String` | `APPLICATION_VERSION` |
    `static java.lang.String` | `BUILD_INFO_FILE` |
    `static java.lang.String` | `DEFAULT_APPLICATION_NAME` |
    `static java.lang.String` | `DEFAULT_SERVLET_VERSION` |
    `static java.lang.String` | `FILE` |
    `static java.lang.String` | `SERVLET_VERSION` |
    `static java.lang.String` | `WAR_DEPLOYED` |
    `private java.util.Map<java.lang.String, java.lang.Object>` | `finalMap` |
    `private static Holder<java.lang.ref.Reference<Metadata>>` | `holder` |
    `private Resource` | `metadataFile` |
    `private java.util.Map<java.lang.String, java.lang.Object>` | `props` |
    `private static long` | `serialVersionUID` |
    `private java.lang.String` | `servletVersion` |
    `private boolean` | `warDeployed` |

  - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `java.lang.String` | `servletVersion`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `private Metadata ()`
    `private Metadata (Resource res)`
    `private Metadata (java.io.File f)`
    `private Metadata (java.io.InputStream inputStream)`
    `private Metadata (java.util.Map<java.lang.String, java.lang.String> properties)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `private void` | `afterLoading()`
    `` | `void` | `clear()`
    `` | `private void` | `clearCatalog(java.util.Map<java.lang.String, java.lang.Object>[] catalog)`
    `` | `private static void` | `closeQuietly(java.io.Closeable c)`
    `` | `boolean` | `containsKey(java.lang.Object key)`
    `` | `private static Metadata` | `createAndBindNew(Resource file)`
    `` | `java.lang.Object` | `get(java.lang.Object key)`
    `` | `java.lang.String` | `getApplicationName()` Returns: The application name
    `` | `java.lang.String` | `getApplicationVersion()` Returns: The application version
    `` | `static Metadata` | `getCurrent()` Returns: the metadata for the current application
    `` | `java.lang.String` | `getEnvironment()` Returns: The environment the application expects to run in
    `` | `private static Metadata` | `getFromMap()`
    `` | `java.lang.String` | `getGrailsVersion()` Returns: The Grails version used to build the application
    `` | `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.
    `` | `static Metadata` | `getInstance(Resource file)` Loads and returns a new Metadata object for the given File.
    `` | `Resource` | `getMetadataFile()`
    `` | `java.lang.Object` | `getOrDefault(java.lang.Object key, java.lang.Object defaultValue)`
    `<T>` | `T` | `getProperty(java.lang.String key, java.lang.Class<T> targetType, T defaultValue)`
    `` | `java.lang.Object` | `getProperty(java.lang.String propertyName)`
    `<T>` | `T` | `getRequiredProperty(java.lang.String key, java.lang.Class<T> targetType)`
    `` | `java.lang.String` | `getServletVersion()` Returns: The version of the servlet spec the application was created for
    `` | `boolean` | `isDevelopmentEnvironmentAvailable()` Returns: True if the development sources are present
    `` | `boolean` | `isWarDeployed()` Returns: true if this application is deployed as a WAR
    `` | `private void` | `loadFromDefault()`
    `` | `private void` | `loadFromFile(Resource file)`
    `` | `private void` | `loadFromInputStream(java.io.InputStream inputStream)`
    `` | `private void` | `loadYml(java.io.InputStream input)`
    `` | `java.lang.Object` | `navigate(java.lang.String[] path)`
    `` | `static Metadata` | `reload()` Reloads the application metadata.
    `` | `static void` | `reset()` Resets the current state of the Metadata so it is re-read.
    `` | `void` | `setServletVersion(java.lang.String servletVersion)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class io.micronaut.context.env.PropertySourcePropertyResolver` | `io.micronaut.context.env.PropertySourcePropertyResolver#isLogEnabled(), io.micronaut.context.env.PropertySourcePropertyResolver#setLogEnabled(boolean), io.micronaut.context.env.PropertySourcePropertyResolver#containsProperty(java.lang.String), io.micronaut.context.env.PropertySourcePropertyResolver#getPropertyEntries(java.lang.String), io.micronaut.context.env.PropertySourcePropertyResolver#addPropertySource(io.micronaut.context.env.PropertySource), io.micronaut.context.env.PropertySourcePropertyResolver#addPropertySource(java.lang.String, java.util.Map), io.micronaut.context.env.PropertySourcePropertyResolver#containsProperties(java.lang.String), io.micronaut.context.env.PropertySourcePropertyResolver#getAllProperties(io.micronaut.core.naming.conventions.StringConvention, io.micronaut.core.convert.format.MapFormat$MapTransformation), io.micronaut.context.env.PropertySourcePropertyResolver#getProperty(java.lang.String, io.micronaut.core.convert.ArgumentConversionContext), io.micronaut.context.env.PropertySourcePropertyResolver#getProperties(java.lang.String, io.micronaut.core.naming.conventions.StringConvention), io.micronaut.context.env.PropertySourcePropertyResolver#close(), io.micronaut.context.env.PropertySourcePropertyResolver#wait(long), io.micronaut.context.env.PropertySourcePropertyResolver#wait(long, int), io.micronaut.context.env.PropertySourcePropertyResolver#wait(), io.micronaut.context.env.PropertySourcePropertyResolver#equals(java.lang.Object), io.micronaut.context.env.PropertySourcePropertyResolver#toString(), io.micronaut.context.env.PropertySourcePropertyResolver#hashCode(), io.micronaut.context.env.PropertySourcePropertyResolver#getClass(), io.micronaut.context.env.PropertySourcePropertyResolver#notify(), io.micronaut.context.env.PropertySourcePropertyResolver#notifyAll(), io.micronaut.context.env.PropertySourcePropertyResolver#getRequiredProperty(java.lang.String, java.lang.Class), io.micronaut.context.env.PropertySourcePropertyResolver#get(java.lang.String, io.micronaut.core.convert.ArgumentConversionContext), io.micronaut.context.env.PropertySourcePropertyResolver#get(java.lang.CharSequence, io.micronaut.core.convert.ArgumentConversionContext), io.micronaut.context.env.PropertySourcePropertyResolver#getProperty(java.lang.String, java.lang.Class, io.micronaut.core.convert.ConversionContext), io.micronaut.context.env.PropertySourcePropertyResolver#getProperty(java.lang.String, java.lang.Class, java.lang.Object), io.micronaut.context.env.PropertySourcePropertyResolver#getProperty(java.lang.String, io.micronaut.core.type.Argument), io.micronaut.context.env.PropertySourcePropertyResolver#getProperty(java.lang.String, java.lang.Class), io.micronaut.context.env.PropertySourcePropertyResolver#getProperties(java.lang.String), io.micronaut.context.env.PropertySourcePropertyResolver#get(java.lang.CharSequence, java.lang.Class, java.lang.Object), io.micronaut.context.env.PropertySourcePropertyResolver#get(java.lang.CharSequence, io.micronaut.core.type.Argument), io.micronaut.context.env.PropertySourcePropertyResolver#get(java.lang.CharSequence, java.lang.Class)`

- - ### Field Detail

    - #### public static final java.lang.String APPLICATION_GRAILS_VERSION

    - #### public static final java.lang.String APPLICATION_NAME

    - #### public static final java.lang.String APPLICATION_VERSION

    - #### public static final java.lang.String BUILD_INFO_FILE

    - #### public static final java.lang.String DEFAULT_APPLICATION_NAME

    - #### public static final java.lang.String DEFAULT_SERVLET_VERSION

    - #### public static final java.lang.String FILE

    - #### public static final java.lang.String SERVLET_VERSION

    - #### public static final java.lang.String WAR_DEPLOYED

    - #### private java.util.Map<java.lang.String, java.lang.Object> finalMap

    - #### private static Holder<java.lang.ref.Reference<Metadata>> holder

    - #### private Resource metadataFile

    - #### private java.util.Map<java.lang.String, java.lang.Object> props

    - #### private static final long serialVersionUID

    - #### private java.lang.String servletVersion

    - #### private boolean warDeployed

  - ### Property Detail

    - #### java.lang.String servletVersion

  - ### Constructor Detail

    - #### private Metadata()

    - #### private Metadata(Resource res)

    - #### private Metadata(java.io.File f)

    - #### private Metadata(java.io.InputStream inputStream)

    - #### private Metadata(java.util.Map<java.lang.String, java.lang.String> properties)

  - ### Method Detail

    - #### private void afterLoading()

    - #### void clear()

    - #### private void clearCatalog(java.util.Map<java.lang.String, java.lang.Object>[] catalog)

    - #### private static void closeQuietly(java.io.Closeable c)

    - #### boolean containsKey(java.lang.Object key)

    - #### private static Metadata createAndBindNew(Resource file)

    - #### @java.lang.Deprecated java.lang.Object get(java.lang.Object key)

    - #### java.lang.String getApplicationName()

      Returns:
        The application name

    - #### java.lang.String getApplicationVersion()

      Returns:
        The application version

    - #### static Metadata getCurrent()

      Returns:
        the metadata for the current application

    - #### java.lang.String getEnvironment()

      Returns:
        The environment the application expects to run in

    - #### private static Metadata getFromMap()

    - #### java.lang.String getGrailsVersion()

      Returns:
        The Grails version used to build the application

    - #### static Metadata getInstance(java.io.InputStream inputStream)

      Loads a Metadata instance from a Reader

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

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

    - #### static Metadata getInstance(Resource file)

      Loads and returns a new Metadata object for the given File.

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

    - #### Resource getMetadataFile()

    - #### java.lang.Object getOrDefault(java.lang.Object key, java.lang.Object defaultValue)

    - #### <T> @java.lang.Override T getProperty(java.lang.String key, java.lang.Class<T> targetType, T defaultValue)

    - #### @java.lang.Deprecated java.lang.Object getProperty(java.lang.String propertyName)

    - #### <T> @java.lang.Override T getRequiredProperty(java.lang.String key, java.lang.Class<T> targetType)

    - #### java.lang.String getServletVersion()

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

    - #### boolean isDevelopmentEnvironmentAvailable()

      Returns:
        True if the development sources are present

    - #### boolean isWarDeployed()

      Returns:
        true if this application is deployed as a WAR

    - #### private void loadFromDefault()

    - #### private void loadFromFile(Resource file)

    - #### private void loadFromInputStream(java.io.InputStream inputStream)

    - #### private void loadYml(java.io.InputStream input)

    - #### @java.lang.Deprecated java.lang.Object navigate(java.lang.String[] path)

    - #### static Metadata reload()

      Reloads the application metadata.

      Returns:
        The metadata object

    - #### static void reset()

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

    - #### void setServletVersion(java.lang.String servletVersion)