Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…versing `soft` and `local` is a fringe use-case
  • Loading branch information...
commit 944b3383f36ccc9e1044b1010d765b002822b410 1 parent 1c84b65
@tschneidereit authored
View
53 src/org/swiftsuspenders/mapping/InjectionMapping.as
@@ -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
{
@@ -188,37 +186,11 @@ package org.swiftsuspenders.mapping
}
/**
- * 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
{
@@ -236,31 +208,6 @@ package org.swiftsuspenders.mapping
}
/**
- * 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>.
*
View
4 test/org/swiftsuspenders/InjectionMappingTests.as
@@ -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)
{
View
20 test/org/swiftsuspenders/InjectorTests.as
@@ -608,17 +608,6 @@ package org.swiftsuspenders
}
[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
{
injector.map(Interface).toType(Clazz).local();
@@ -634,15 +623,6 @@ package org.swiftsuspenders
}
[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
{
assertThat(constructMappedTypeAndListenForEvent(InjectionEvent.POST_INSTANTIATE), isTrue());
Please sign in to comment.
Something went wrong with that request. Please try again.