Description

An automatic class-loader for D.

Package Information

Version0.1.0 (2016-Jan-25)
Repositoryhttps://github.com/Mihail-K/autoloader
LicenseMIT
CopyrightCopyright © 2016, Mihail K
AuthorsMihail-K
Registered byMihail K
Dependenciesnone

Installation

To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Readme

autoloader

An automatic class-loader for D.

Hello World

Create a class that you want to load,

module app.hello_world;

class HelloWorld
{
    // Your class
}

Create an autoloader and load the class,

import autoloader;

void main()
{
    // Tell our autoloader to search in 'app'
    auto loader = new BasicAutoloader(["app"]);
    
    // Load and construct HelloWorld
    Object o = loader.create("HelloWorld");
}

Conventions

The autoloader is designed around convention over configuration, so it assumes that a class is located in a module under the same name but in lowersnakecase. For example,

ClassRelative Search Path
Foofoo.Foo
BARbar.BAR
URLParserurl_parser.URLParser
HttpServicehttp_service.HttpService

Overriding the lookup(name) function allows classes to change this behaviour.

License

MIT

Available versions

0.1.0 ~master