org.jvnet.hk2.component
Class Creators

java.lang.Object
  extended by org.jvnet.hk2.component.Creators

public class Creators
extends Object

Creator factory.

Author:
Kohsuke Kawaguchi

Constructor Summary
Creators()
           
 
Method Summary
static
<T> Creator<T>
create(Class<T> c, Habitat habitat, MultiMap<String,String> metadata)
           
static List<Inhabitant<? extends InjectionResolver>> getAllInjectionResolvers(Habitat habitat)
          Returns all currently available injection annotations
static boolean isInjectable(Set<Class<? extends Annotation>> injectionAnnotations, AnnotatedElement ae)
           
static
<T> void
qualifyingConstructors(Class<T> c, List<Constructor<?>> allList, Set<Class<? extends Annotation>> injectionAnnotations, Reference<Constructor<T>> defaultCtor, Reference<Constructor<T>> noArgCtor)
          Returns all "eligible" constructors for injection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Creators

public Creators()
Method Detail

create

public static <T> Creator<T> create(Class<T> c,
                                    Habitat habitat,
                                    MultiMap<String,String> metadata)

getAllInjectionResolvers

public static List<Inhabitant<? extends InjectionResolver>> getAllInjectionResolvers(Habitat habitat)
Returns all currently available injection annotations

Parameters:
habitat - the service registry
Returns:
the list of injection resolvers registered in this service registry in its parent.

qualifyingConstructors

public static <T> void qualifyingConstructors(Class<T> c,
                                              List<Constructor<?>> allList,
                                              Set<Class<? extends Annotation>> injectionAnnotations,
                                              Reference<Constructor<T>> defaultCtor,
                                              Reference<Constructor<T>> noArgCtor)
Returns all "eligible" constructors for injection. Eligibility is determined by: (a) the no-arg constructor, or (b) @Inject annotated constructor.

Note, however, that this does not verify that the arguments on the constructor are indeed injectable out of the habitat.

Parameters:
c - The class to find the constructors for
defaultCtor - (optional) The "favored" default constructor reference; meaning that all arguments can be injected based on the contents of the habitat
noArgCtor - (optional The no-arg constructor reference

isInjectable

public static boolean isInjectable(Set<Class<? extends Annotation>> injectionAnnotations,
                                   AnnotatedElement ae)


Copyright © 2011 Oracle Corporation. All Rights Reserved.