Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStuart McCulloch2015-01-22 23:29:31 +0000
committerStuart McCulloch2015-01-22 23:29:31 +0000
commit7761c7478fdf38d74c7d112665d13af941d3249d (patch)
treec5add65776f34653b03936371855842b63cca112
parent09c9088c7f52d54a68af602b0e36ac3291684302 (diff)
downloadorg.eclipse.sisu.plexus-7761c7478fdf38d74c7d112665d13af941d3249d.tar.gz
org.eclipse.sisu.plexus-7761c7478fdf38d74c7d112665d13af941d3249d.tar.xz
org.eclipse.sisu.plexus-7761c7478fdf38d74c7d112665d13af941d3249d.zip
Bug 427260: use new Sources helper methods
-rw-r--r--org.eclipse.sisu.plexus.tests/src/org/eclipse/sisu/plexus/PlexusBeanLocatorTest.java8
-rw-r--r--org.eclipse.sisu.plexus/src/org/eclipse/sisu/plexus/PlexusTypeBinder.java46
2 files changed, 3 insertions, 51 deletions
diff --git a/org.eclipse.sisu.plexus.tests/src/org/eclipse/sisu/plexus/PlexusBeanLocatorTest.java b/org.eclipse.sisu.plexus.tests/src/org/eclipse/sisu/plexus/PlexusBeanLocatorTest.java
index 0826585..e445267 100644
--- a/org.eclipse.sisu.plexus.tests/src/org/eclipse/sisu/plexus/PlexusBeanLocatorTest.java
+++ b/org.eclipse.sisu.plexus.tests/src/org/eclipse/sisu/plexus/PlexusBeanLocatorTest.java
@@ -20,8 +20,8 @@ import org.codehaus.plexus.classworlds.ClassWorldException;
import org.codehaus.plexus.classworlds.realm.DuplicateRealmException;
import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
import org.eclipse.sisu.inject.DefaultBeanLocator;
-import org.eclipse.sisu.inject.HiddenBinding;
import org.eclipse.sisu.inject.MutableBeanLocator;
+import org.eclipse.sisu.inject.Sources;
import com.google.inject.AbstractModule;
import com.google.inject.Binder;
@@ -38,10 +38,6 @@ import com.google.inject.name.Names;
public class PlexusBeanLocatorTest
extends TestCase
{
- static final HiddenBinding TEST_HIDDEN_SOURCE = new HiddenBinding()
- {
- };
-
@ImplementedBy( BeanImpl.class )
interface Bean
{
@@ -81,7 +77,7 @@ public class PlexusBeanLocatorTest
protected void configure()
{
bind( Bean.class ).annotatedWith( Names.named( "M1" ) ).to( BeanImpl.class );
- final Binder hiddenBinder = binder().withSource( TEST_HIDDEN_SOURCE );
+ final Binder hiddenBinder = binder().withSource( Sources.hide() );
hiddenBinder.bind( Bean.class ).annotatedWith( Names.named( "!" ) ).to( BeanImpl.class );
bind( Bean.class ).annotatedWith( Names.named( "N1" ) ).to( BeanImpl.class );
}
diff --git a/org.eclipse.sisu.plexus/src/org/eclipse/sisu/plexus/PlexusTypeBinder.java b/org.eclipse.sisu.plexus/src/org/eclipse/sisu/plexus/PlexusTypeBinder.java
index 5b1fc7f..5cef414 100644
--- a/org.eclipse.sisu.plexus/src/org/eclipse/sisu/plexus/PlexusTypeBinder.java
+++ b/org.eclipse.sisu.plexus/src/org/eclipse/sisu/plexus/PlexusTypeBinder.java
@@ -104,52 +104,8 @@ public final class PlexusTypeBinder
{
if ( null != description && description.length() > 0 )
{
- return binder.withSource( new PlexusDescribedBinding( source, description ) );
+ return binder.withSource( Sources.describe( source, description ) );
}
return binder.withSource( source );
}
-
- // ----------------------------------------------------------------------
- // Implementation types
- // ----------------------------------------------------------------------
-
- /**
- * {@link DescribedBinding} that captures Plexus descriptions.
- */
- private static final class PlexusDescribedBinding
- implements Sources.Described
- {
- // ----------------------------------------------------------------------
- // Implementation fields
- // ----------------------------------------------------------------------
-
- private final Object source;
-
- private final String description;
-
- // ----------------------------------------------------------------------
- // Constructors
- // ----------------------------------------------------------------------
-
- PlexusDescribedBinding( final Object source, final String description )
- {
- this.source = source;
- this.description = description;
- }
-
- // ----------------------------------------------------------------------
- // Public methods
- // ----------------------------------------------------------------------
-
- public String getDescription()
- {
- return description;
- }
-
- @Override
- public String toString()
- {
- return source.toString();
- }
- }
}

Back to the top