Component registration info - Parametric names vs annotations

A component that implements ParametricComponent may not have a name
specified using the Component annotation.
This commit is contained in:
Emmanuel BENOîT 2015-09-14 08:54:16 +02:00
parent b13db82be2
commit d502d6f6b9

View file

@ -58,6 +58,9 @@ public final class NewComponentInfo< T >
// Sets the new component's name
final Component aComp = klass.getAnnotation( Component.class );
if ( aComp != null && !"".equals( aComp.value( ) ) ) {
if ( ParametricComponent.class.isAssignableFrom( klass ) ) {
throw new ComponentDefinitionException( "parametric component can't be named" );
}
info.setName( aComp.value( ) );
} else if ( !ParametricComponent.class.isAssignableFrom( klass ) ) {
info.setName( klass.getSimpleName( ) );