Bug 427260: use new Sources helper methods
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.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 @@
public class PlexusBeanLocatorTest
extends TestCase
{
- static final HiddenBinding TEST_HIDDEN_SOURCE = new HiddenBinding()
- {
- };
-
@ImplementedBy( BeanImpl.class )
interface Bean
{
@@ -81,7 +77,7 @@
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 @@
{
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();
- }
- }
}