5.7.1 Evaluating Conventions

Every Griffon application exposes all information about its artifacts and addons via a pair of helper classes

- `AddonManager` - used for all installed addons
- `ArtifactManager` - used for all remaining artifacts

#### ArtifactManager

The `ArtifactManager` class provides methods to evaluate the conventions within the project and internally stores references to all classes within a GriffonApplication using subclasses of GriffonClass class.

A `GriffonClass` represents a physical Griffon resources such as a controller or a service. For example to get all `GriffonClass` instances you can call:

    app.artifactManager.allClasses.each { println it.name }

There are a few "magic" properties that the `ArtifactManager` instance possesses that allow you to narrow the type of artifact you are interested in. For example if you only need to deal with controllers you can do:

    app.artifactManager.controllerClasses.each { println it.name }

Dynamic method conventions are as follows:

- `get*Classes` - Retrieves all the classes for a particular artifact type. Example `app.artifactManager.getControllerClasses()`.
- `*Classes` - Retrieves all the classes for a particular artifact type. Example `app.artifactManager.controllerClasses`.
- `is*Class` - Returns true if the given class is of the given artifact type. Example `app.artifactManager.isControllerClass(ExampleController)`

The `GriffonClass` interface itself provides a number of useful methods that allow you to further evaluate and work with the conventions. These include:

- `newInstance` - Creates a new instance of the enclosed class.
- `getName` - Returns the logical name of the class in the application without the trailing convention part if applicable
- `getClazz` - Returns the artifact class
- `getType` - Returns the type of the artifact, i.e "controller"
- `getTrailing` - Returns the suffix (if any) of the artifact, i.e "Controller"

For a full reference refer to the javadoc API.

#### AddonManager

The `AddonManager` class is responsible for holding references to all addons (which are of type griffon.core.GriffonAddon), as well as providing metainformation on each addon via an addon descriptor. The latter can be used to know at runtime the name and version of a particular addon, useful for building a dynamic About dialog for example.

All addons have the same behavior which is explained in detail in section 12.6 Addons.