Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.pietschy.command.configuration.impl
Class DefaultConfigurationLoader

    java.lang.Object
      com.pietschy.command.configuration.impl.DefaultConfigurationLoader

All Implemented Interfaces:
  ConfigurationLoader

    public class DefaultConfigurationLoader

extends java.lang.Object
implements ConfigurationLoader

Default implementation of `ConfigurationLoader`.

Constructor Summary
`DefaultConfigurationLoader()` Creates a new instance.
`DefaultConfigurationLoader(ConfigurationCache cache, ConfigurationParser parser)` Creates a new instance with the specified cache and parser.

Method Summary
`void` | `configure(Command command)` Configures the specified command from the configuration cache using the most appropriate `Configurator`.
`(package private) Configurator` | `getConfiguratorFor(Command command)` Get the best `Configurator` for the specified command.
`java.lang.String` | `getGroupClassName(java.lang.String id)` Gets the class name specified for the group with the specified id.
`boolean` | `isAutoCreate(java.lang.String id)` Checks if the specified Id represents a group that has been marked as autoCreate.
`boolean` | `isGroup(java.lang.String id)` Checks if the specified Id represents a `CommandGroup`.
`boolean` | `isToggleGroup(java.lang.String id)` Checks if the specified Id represents a `ToggleGroup`.
`void` | `load(java.util.ResourceBundle bundle)` Loads the specified resource bundle into the configuration cache.
`(package private) void` | `register(java.lang.Class<? extends Command> clazz, Configurator configurator)` Registers the specified configurator.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultConfigurationLoader

    public DefaultConfigurationLoader()

  Creates a new instance.

### DefaultConfigurationLoader

    DefaultConfigurationLoader(ConfigurationCache cache,
                               ConfigurationParser parser)

  Creates a new instance with the specified cache and parser. This constructor exists for testing purposes.

  Parameters:
    `cache` - the cache to use.
    `parser` - the parser to use.

Method Detail

### register

    void register(java.lang.Class<? extends Command> clazz,
                  Configurator configurator)

  Registers the specified configurator.

  Parameters:
    `clazz` - the command class
    `configurator` - the configurator

### load

    public void load(java.util.ResourceBundle bundle)
              throws ParseException

  Loads the specified resource bundle into the configuration cache.

  Specified by:
    `load` in interface `ConfigurationLoader`
  Parameters:
    `bundle` - the bundle to load.
  Throws:
    `ParseException` - if there was an error parsing the bundle.

### configure

    public void configure(Command command)
                   throws ConfigurationException

  Configures the specified command from the configuration cache using the most appropriate `Configurator`.

  Specified by:
    `configure` in interface `ConfigurationLoader`
  Parameters:
    `command` - the command to configure.
  Throws:
    `ConfigurationException` - if there was an error configuring the command.

### getConfiguratorFor

    Configurator getConfiguratorFor(Command command)

  Get the best `Configurator` for the specified command.

  Parameters:
    `command` - the command
  Returns:
    the best configurator for the specified command.

### isGroup

    public boolean isGroup(java.lang.String id)

  Checks if the specified Id represents a `CommandGroup`.

  Specified by:
    `isGroup` in interface `ConfigurationLoader`
  Parameters:
    `id` - the id to check.
  Returns:
    `true` if the configuration for the specified id exists and is for a `CommandGroup`.

### isToggleGroup

    public boolean isToggleGroup(java.lang.String id)

  Checks if the specified Id represents a `ToggleGroup`.

  Specified by:
    `isToggleGroup` in interface `ConfigurationLoader`
  Parameters:
    `id` - the id to check.
  Returns:
    `true` if the configuration for the specified id exists and is for a `ToggleGroup`.

### isAutoCreate

    public boolean isAutoCreate(java.lang.String id)

  Checks if the specified Id represents a group that has been marked as autoCreate.

  Specified by:
    `isAutoCreate` in interface `ConfigurationLoader`
  Parameters:
    `id` - the id to check.
  Returns:
    `true` if the configuration for the specified id is a group and has been configured for automatic creation.

### getGroupClassName

    public java.lang.String getGroupClassName(java.lang.String id)

  Gets the class name specified for the group with the specified id.

  Specified by:
    `getGroupClassName` in interface `ConfigurationLoader`
  Parameters:
    `id` - the group to check.
  Returns:
    the class name of the specified group, or `null` if no class has been explicitly specified.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 - 2007 Andrew Pietsch