Permalink
Browse files

Removes `InjectionMapping#strong` and `InjectionMapping#shared` as re…

…versing `soft` and `local` is a fringe use-case
  • Loading branch information...
1 parent 1c84b65 commit 944b3383f36ccc9e1044b1010d765b002822b410 @tschneidereit committed Jun 8, 2012
@@ -170,8 +170,6 @@ package org.swiftsuspenders.mapping
* @return The <code>InjectionMapping</code> the method is invoked on
*
* @throws org.swiftsuspenders.InjectorError Sealed mappings can't be changed in any way
- *
- * @see #strong()
*/
public function soft() : InjectionMapping
{
@@ -187,38 +185,12 @@ package org.swiftsuspenders.mapping
return this;
}
- /**
- * Reverts the effect of <code>soft()</code> and makes the Injector the mapping is defined
- * in stop looking up its inheritance chain for the mapped request immediately.
- *
- * @return The <code>InjectionMapping</code> the method is invoked on
- *
- * @throws org.swiftsuspenders.InjectorError Sealed mappings can't be changed in any way
- *
- * @see #soft()
- */
- public function strong() : InjectionMapping
- {
- _sealed && throwSealedError();
- if (_soft)
- {
- const provider : DependencyProvider = getProvider();
- dispatchPreChangeEvent();
- _soft = false;
- mapProvider(provider);
- dispatchPostChangeEvent();
- }
- return this;
- }
-
/**
* Disables sharing the mapping with child Injectors of the Injector it is defined in.
*
* @return The <code>InjectionMapping</code> the method is invoked on
*
* @throws org.swiftsuspenders.InjectorError Sealed mappings can't be changed in any way
- *
- * @see #shared()
*/
public function local() : InjectionMapping
{
@@ -235,31 +207,6 @@ package org.swiftsuspenders.mapping
return this;
}
- /**
- * Reverts the effect of <code>local</code>, enables sharing the mapping with child
- * Injectors of the Injector it is defined in.
- *
- * @return The <code>InjectionMapping</code> the method is invoked on
- *
- * @throws org.swiftsuspenders.InjectorError Sealed mappings can't be changed in any way
- *
- * @see #local()
- */
- public function shared() : InjectionMapping
- {
- _sealed && throwSealedError();
- if (!_local)
- {
- return this;
- }
- const provider : DependencyProvider = getProvider();
- dispatchPreChangeEvent();
- _local = false;
- mapProvider(provider);
- dispatchPostChangeEvent();
- return this;
- }
-
/**
* Prevents all subsequent changes to the mapping, including removal. Trying to change it
* in any way at all will throw an <code>InjectorError</code>.
@@ -107,9 +107,7 @@ package org.swiftsuspenders
{method : 'toValue', args : [Clazz]},
{method : 'toProvider', args : [null]},
{method : 'local', args : []},
- {method : 'shared', args : []},
- {method : 'soft', args : []},
- {method : 'strong', args : []}];
+ {method : 'soft', args : []}];
const testedMethods : Array = [];
for each (var method : Object in methods)
{
@@ -607,17 +607,6 @@ package org.swiftsuspenders
Assert.assertEquals(Clazz, childInjector.getInstance(Interface)['constructor']);
}
- [Test]
- public function callingStrongTurnsSoftMappingsIntoStrongOnes() : void
- {
- const childInjector : Injector = injector.createChildInjector();
- injector.map(Interface).toType(Clazz);
- childInjector.map(Interface).toType(Clazz2).soft();
- Assert.assertEquals(Clazz, childInjector.getInstance(Interface)['constructor']);
- childInjector.map(Interface).toType(Clazz2).strong();
- Assert.assertEquals(Clazz2, childInjector.getInstance(Interface)['constructor']);
- }
-
[Test]
public function localMappingsAreUsedInOwnInjector() : void
{
@@ -633,15 +622,6 @@ package org.swiftsuspenders
childInjector.getInstance(Interface);
}
- [Test]
- public function callingSharedTurnsLocalMappingsIntoSharedOnes() : void
- {
- const childInjector : Injector = injector.createChildInjector();
- injector.map(Interface).toType(Clazz).local();
- injector.map(Interface).toType(Clazz).shared();
- Assert.assertNotNull(childInjector.getInstance(Interface));
- }
-
[Test]
public function injectorDispatchesPostInstantiateEventDuringInstanceConstruction() : void
{

0 comments on commit 944b338

Please sign in to comment.