in org.eclipse.sisu.inject/src/org/eclipse/sisu/bean/BeanListener.java [48:96]
public <B> void hear( final TypeLiteral<B> type, final TypeEncounter<B> encounter )
{
final PropertyBinder propertyBinder = beanBinder.bindBean( type, encounter );
if ( null == propertyBinder )
{
return; // no properties to bind
}
final List<PropertyBinding> bindings = new ArrayList<PropertyBinding>();
final Set<String> visited = new HashSet<String>();
for ( final BeanProperty<?> property : new BeanProperties( type.getRawType() ) )
{
if ( property.getAnnotation( javax.inject.Inject.class ) != null
|| property.getAnnotation( com.google.inject.Inject.class ) != null )
{
continue; // these properties will have already been injected by Guice
}
final String name = property.getName();
if ( visited.add( name ) )
{
try
{
final PropertyBinding binding = propertyBinder.bindProperty( property );
if ( binding == PropertyBinder.LAST_BINDING )
{
break; // no more bindings
}
if ( binding != null )
{
bindings.add( binding );
}
else
{
visited.remove( name );
}
}
catch ( final RuntimeException e )
{
encounter.addError( new ProvisionException( "Error binding: " + property, e ) );
}
}
}
if ( bindings.size() > 0 )
{
encounter.register( new BeanInjector<B>( bindings ) );
}
}