Griffon Guide 0.9.5-rc2 - Reference Documentation

# newInstance(Class klass, String type = "")

## Purpose

Create a new artifact instance

## Examples

    class SampleController {
        def action = { evt = null ->
            def myService = newInstance(MyServiceClass, 'service')
        }
    }

## Description

This method creates a new instance of a particular class and type. It is a convenience method that fires an event after the instance has been created, the application will not perform additional management for an instance created in this way.

Fired Events:

- `NewInstance` - after the instance has been created