{
// @State Property<String> name;
StateDescriptor descriptor;
descriptor = ( (StatefulCompositeDescriptor) resolution.model() ).state();
State annotation = (State) dependencyModel.injectionAnnotation();
String name;
if( annotation.value().isEmpty() )
{
name = resolution.field().getName();
}
else
{
name = annotation.value();
}
PropertyDescriptor propertyDescriptor = descriptor.findPropertyModelByName( name );
return new PropertyInjectionProvider( propertyDescriptor );
}
else if( Association.class.isAssignableFrom( dependencyModel.rawInjectionType() ) )
{
// @State Association<MyEntity> name;
AssociationStateDescriptor descriptor = ( (EntityDescriptor) resolution.model() ).state();
State annotation = (State) dependencyModel.injectionAnnotation();
String name;
if( annotation.value().isEmpty() )
{
name = resolution.field().getName();
}
else
{
name = annotation.value();
}
AssociationDescriptor model = descriptor.getAssociationByName( name );
return new AssociationInjectionProvider( model );
}
else if( ManyAssociation.class.isAssignableFrom( dependencyModel.rawInjectionType() ) )
{
// @State ManyAssociation<MyEntity> name;
AssociationStateDescriptor descriptor = ( (EntityDescriptor) resolution.model() ).state();
State annotation = (State) dependencyModel.injectionAnnotation();
String name;
if( annotation.value().isEmpty() )
{
name = resolution.field().getName();
}
else
{
name = annotation.value();
}
AssociationDescriptor model = descriptor.getManyAssociationByName( name );
return new ManyAssociationInjectionProvider( model );
}
else if( NamedAssociation.class.isAssignableFrom( dependencyModel.rawInjectionType() ) )
{
// @State NamedAssociation<MyEntity> name;
AssociationStateDescriptor descriptor = ( (EntityDescriptor) resolution.model() ).state();
State annotation = (State) dependencyModel.injectionAnnotation();
String name;
if( annotation.value().isEmpty() )
{
name = resolution.field().getName();
}
else
{
name = annotation.value();
}
AssociationDescriptor model = descriptor.getNamedAssociationByName( name );
return new NamedAssociationInjectionProvider( model );
}