1 /**
2 Contains a specific implementation of generic factory used solely in conjunction
3 with register api.
4 
5 License:
6 	Boost Software License - Version 1.0 - August 17th, 2003
7 
8 	Permission is hereby granted, free of charge, to any person or organization
9 	obtaining a copy of the software and accompanying documentation covered by
10 	this license (the "Software") to use, reproduce, display, distribute,
11 	execute, and transmit the Software, and to prepare derivative works of the
12 	Software, and to permit third-parties to whom the Software is furnished to
13 	do so, all subject to the following:
14 	
15 	The copyright notices in the Software and this entire statement, including
16 	the above license grant, this restriction and the following disclaimer,
17 	must be included in all copies of the Software, in whole or in part, and
18 	all derivative works of the Software, unless such copies or derivative
19 	works are solely in the form of machine-executable object code generated by
20 	a source language processor.
21 	
22 	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 	FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
25 	SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
26 	FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
27 	ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28 	DEALINGS IN THE SOFTWARE.
29 
30 Authors:
31 	aermicioi
32 **/
33 module aermicioi.aedi.configurer.register.generic_factory_metadata_decorator;
34 
35 import aermicioi.aedi.storage.storage;
36 import aermicioi.aedi.factory.factory;
37 import aermicioi.aedi.factory.generic_factory;
38 import aermicioi.aedi.factory.decorating_factory;
39 
40 package {
41     import aermicioi.aedi.factory.decorating_factory;
42     
43     /**
44     A decorator over generic factory, that sole purpose is to contain
45     additional metadata usable for register api primitives.
46     **/
47     class MetadataDecoratedGenericFactory(T) : DecoratableGenericFactory!T {
48         
49         private {
50             Storage!(ObjectFactory, string) storage_;
51             ObjectFactory wrapper_;
52             GenericFactory!T decorated_;
53             string identity_;
54             string storageIdentity_;
55         }
56         
57         public {
58             @property {
59             	MetadataDecoratedGenericFactory!T storage(Storage!(ObjectFactory, string) storage) @safe nothrow {
60             		this.storage_ = storage;
61             	
62             		return this;
63             	}
64             	
65             	Storage!(ObjectFactory, string) storage() @safe nothrow {
66             		return this.storage_;
67             	}
68             	
69             	MetadataDecoratedGenericFactory!T identity(string identity) @safe nothrow {
70             		this.identity_ = identity;
71             	
72             		return this;
73             	}
74             	
75             	string identity() @safe nothrow {
76             		return this.identity_;
77             	}
78             	
79             	MetadataDecoratedGenericFactory!T storageIdentity(string storageIdentity) @safe nothrow {
80             		this.storageIdentity_ = storageIdentity;
81             	
82             		return this;
83             	}
84             	
85             	string storageIdentity() @safe nothrow {
86             		return this.storageIdentity_;
87             	}
88             	
89             	MetadataDecoratedGenericFactory!T wrapper(ObjectFactory wrapper) @safe nothrow {
90             		this.wrapper_ = wrapper;
91             	
92             		return this;
93             	}
94             	
95             	ObjectFactory wrapper() @safe nothrow {
96             		return this.wrapper_;
97             	}
98             }
99         }
100     }
101 }