Comments (4)
Should the first snippet read Injector#mapFactoryClass()
? What is a factory? Did you like his Provider annotation? That could negate any inter-library interface dependency.
from swiftsuspenders.
Yes, that's what I meant, thanks. I've corrected the text.
I like the [Provider] annotation indeed: Much better than to prescribe an interface for the factory. Also, it enables multiple factory methods in one class, each annoted with [Provider] and selected by its return type.
I haven't found any standard annotations, but will look some more. If Guice or Spring support something similar, it might be worthwhile to use they annoation syntax.
from swiftsuspenders.
I hadn't considered multiple Providers brilliant!
from swiftsuspenders.
Instead of explicitly supporting factory mappings, Swiftsuspenders 2 will have a generic way of mapping to custom providers that only need to implement the method apply(targetClass:Class, usingInjector:Injector):Object
. To make it easier to use the custom provider, Swiftsuspenders 2 comes bundled with a FactoryProvider that takes a Class implementing DependencyProvider as a ctor argument and construct an instance of that class for each application, enabling easy implementation of DepencyProviders with their own dependencies.
from swiftsuspenders.
Related Issues (20)
- Named injections, map.toValue(null), satisfies() and getInstance() HOT 6
- Metadata.xml HOT 5
- loggable warning HOT 4
- Reflector HOT 1
- Support destruction of instances and teardown of entire containers HOT 21
- Building the SWC HOT 7
- ApplicationDomain::getDefinition Explodes Fantastically HOT 1
- Teardown nulls the _mappings dict
- DescribeTypeReflector VerifyError: Error #1068: String and * cannot be reconciled. HOT 3
- Asymmetry between satisfies & satisfiesDirectly HOT 2
- More specific InjectorError sub types HOT 4
- Null values passed to Injected constructor with multiple name-quailified injections HOT 13
- Can't build with Maven HOT 3
- Versioning HOT 6
- Feature Request -- "Mapping"-specific injections
- InstantiateUnmapped Performance HOT 2
- Injector still needs an interface ... HOT 6
- docs HOT 1
- Updated build script to preserve code comments in SWC HOT 2
- No issue , is suggest HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftsuspenders.