org.guiceyfruit.spring.support
Class AutowiredMemberProvider

java.lang.Object
  extended by org.guiceyfruit.support.AnnotationMemberProviderSupport<org.springframework.beans.factory.annotation.Autowired>
      extended by org.guiceyfruit.spring.support.AutowiredMemberProvider
All Implemented Interfaces:
AnnotationMemberProvider<org.springframework.beans.factory.annotation.Autowired>

public class AutowiredMemberProvider
extends AnnotationMemberProviderSupport<org.springframework.beans.factory.annotation.Autowired>

Creates a value for an Autowired member with an optional Qualifier annotation

Version:
$Revision: 1.1 $

Constructor Summary
AutowiredMemberProvider(com.google.inject.Injector injector)
           
 
Method Summary
protected  java.util.Collection createCollection(java.lang.Class<?> type)
           
protected  java.util.Map createMap(java.lang.Class<?> type)
           
protected  Predicate<com.google.inject.Binding> createQualifierFilter(java.lang.reflect.Member member, java.lang.annotation.Annotation[] parameterAnnotations)
          Returns a new filter on the given member to respect the use of Qualifier annotations or annotations annotated with Qualifier
protected  java.util.Set<com.google.inject.Binding<?>> getSortedBindings(java.lang.Class<?> type, Predicate<com.google.inject.Binding> filter)
           
 boolean isNullParameterAllowed(org.springframework.beans.factory.annotation.Autowired annotation, java.lang.reflect.Method method, java.lang.Class<?> parameterType, int parameterIndex)
          Returns true if the given parameter on the annotated method can be null
protected  boolean isQualified(java.lang.annotation.Annotation annotation)
          Returns true if the annotation is a qualified annotation and a valid Guice binding annotation
protected  boolean isValidAutowireBinding(com.google.inject.Binding<?> binding)
           
static java.util.List<com.google.inject.Key<?>> keys(java.lang.Iterable<com.google.inject.Binding<?>> bindings)
          Returns the keys used in the given bindings
protected  java.lang.Object provide(org.springframework.beans.factory.annotation.Autowired annotation, java.lang.reflect.Member member, com.google.inject.TypeLiteral<?> typeLiteral, java.lang.Class<?> memberType, java.lang.annotation.Annotation[] annotations)
          The default method to create a value for the named member of the requested type
protected  java.lang.Object provideArrayValue(java.lang.reflect.Member member, com.google.inject.TypeLiteral<?> type, java.lang.Class<?> memberType, Predicate<com.google.inject.Binding> filter)
           
protected  java.util.Map provideMapValues(java.util.Map map, java.lang.reflect.Member member, com.google.inject.TypeLiteral<?> type, Predicate<com.google.inject.Binding> filter)
           
protected  java.lang.Object provideSingleValue(java.lang.reflect.Member member, java.lang.Class<?> type, org.springframework.beans.factory.annotation.Autowired annotation, Predicate<com.google.inject.Binding> filter)
           
protected  java.lang.Object tryCreateInstance(java.lang.Class<?> type)
          Returns a new instance of the given class if its a public non abstract class which has a public zero argument constructor otherwise returns null
protected static java.lang.String typeName(com.google.inject.Binding<?> bindings)
           
 
Methods inherited from class org.guiceyfruit.support.AnnotationMemberProviderSupport
provide, provide
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutowiredMemberProvider

@Inject
public AutowiredMemberProvider(com.google.inject.Injector injector)
Method Detail

isNullParameterAllowed

public boolean isNullParameterAllowed(org.springframework.beans.factory.annotation.Autowired annotation,
                                      java.lang.reflect.Method method,
                                      java.lang.Class<?> parameterType,
                                      int parameterIndex)
Description copied from interface: AnnotationMemberProvider
Returns true if the given parameter on the annotated method can be null


provide

protected java.lang.Object provide(org.springframework.beans.factory.annotation.Autowired annotation,
                                   java.lang.reflect.Member member,
                                   com.google.inject.TypeLiteral<?> typeLiteral,
                                   java.lang.Class<?> memberType,
                                   java.lang.annotation.Annotation[] annotations)
Description copied from class: AnnotationMemberProviderSupport
The default method to create a value for the named member of the requested type

Specified by:
provide in class AnnotationMemberProviderSupport<org.springframework.beans.factory.annotation.Autowired>

createQualifierFilter

protected Predicate<com.google.inject.Binding> createQualifierFilter(java.lang.reflect.Member member,
                                                                     java.lang.annotation.Annotation[] parameterAnnotations)
Returns a new filter on the given member to respect the use of Qualifier annotations or annotations annotated with Qualifier


isQualified

protected boolean isQualified(java.lang.annotation.Annotation annotation)
Returns true if the annotation is a qualified annotation and a valid Guice binding annotation


provideSingleValue

protected java.lang.Object provideSingleValue(java.lang.reflect.Member member,
                                              java.lang.Class<?> type,
                                              org.springframework.beans.factory.annotation.Autowired annotation,
                                              Predicate<com.google.inject.Binding> filter)

keys

public static java.util.List<com.google.inject.Key<?>> keys(java.lang.Iterable<com.google.inject.Binding<?>> bindings)
Returns the keys used in the given bindings


provideArrayValue

protected java.lang.Object provideArrayValue(java.lang.reflect.Member member,
                                             com.google.inject.TypeLiteral<?> type,
                                             java.lang.Class<?> memberType,
                                             Predicate<com.google.inject.Binding> filter)

provideMapValues

protected java.util.Map provideMapValues(java.util.Map map,
                                         java.lang.reflect.Member member,
                                         com.google.inject.TypeLiteral<?> type,
                                         Predicate<com.google.inject.Binding> filter)

createMap

protected java.util.Map createMap(java.lang.Class<?> type)

createCollection

protected java.util.Collection createCollection(java.lang.Class<?> type)

tryCreateInstance

protected java.lang.Object tryCreateInstance(java.lang.Class<?> type)
Returns a new instance of the given class if its a public non abstract class which has a public zero argument constructor otherwise returns null


getSortedBindings

protected java.util.Set<com.google.inject.Binding<?>> getSortedBindings(java.lang.Class<?> type,
                                                                        Predicate<com.google.inject.Binding> filter)

isValidAutowireBinding

protected boolean isValidAutowireBinding(com.google.inject.Binding<?> binding)

typeName

protected static java.lang.String typeName(com.google.inject.Binding<?> bindings)


Copyright © 2011. All Rights Reserved.