From f9c2e257c7ab1446ea8982f2461c5bd357e979fe Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Sat, 21 Feb 2015 16:11:43 +0100 Subject: [PATCH] Document public API of module "registration" --- source/poodinis/registration.d | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/source/poodinis/registration.d b/source/poodinis/registration.d index 6bcec83..1190277 100644 --- a/source/poodinis/registration.d +++ b/source/poodinis/registration.d @@ -1,8 +1,12 @@ /** - * Poodinis Dependency Injection Framework - * Copyright 2014-2015 Mike Bierlee - * This software is licensed under the terms of the MIT license. - * The full terms of the license can be found in the LICENSE file. + * This module contains objects for defining and scoping dependency registrations. + * + * Authors: + * Mike Bierlee, m.bierlee@lostmoment.com + * Copyright: 2014-2015 Mike Bierlee + * License: + * This software is licensed under the terms of the MIT license. + * The full terms of the license can be found in the LICENSE file. */ module poodinis.registration; @@ -75,6 +79,11 @@ class SingleInstanceScope : CreationScope { } } +/** + * Scopes registrations to return the same instance every time a given registration is resolved. + * + * Effectively makes the given registration a singleton. + */ public Registration singleInstance(Registration registration) { registration.registationScope = new SingleInstanceScope(registration.instantiatableType); return registration; @@ -95,6 +104,9 @@ class NewInstanceScope : CreationScope { } } +/** + * Scopes registrations to return a new instance every time the given registration is resolved. + */ public Registration newInstance(Registration registration) { registration.registationScope = new NewInstanceScope(registration.instantiatableType); return registration; @@ -115,6 +127,9 @@ class ExistingInstanceScope : CreationScope { } } +/** + * Scopes registrations to return the given instance every time the given registration is resolved. + */ public Registration existingInstance(Registration registration, Object instance) { registration.registationScope = new ExistingInstanceScope(instance); return registration;