public static Object createInjectedInstance
                    (Class<?> targetClass,
                     HashMap<Class<?>, InjectionTarget[]> injectionTargetMap)
                                    throws InjectionException,
                                    IllegalAccessException,
                                    InstantiationException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "createInjectedInstance : " + targetClass + ", " +
                         (injectionTargetMap == null ? "null"
                                         : Util.identity(injectionTargetMap.get(targetClass))));

        InjectionTarget[] targets = null;
        Object instance = targetClass.newInstance();

        if (injectionTargetMap != null)
        {
            targets = injectionTargetMap.get(targetClass);

            if (targets != null)
            {
                InjectionEngine injectionEngine = InjectionEngineAccessor.getInstance();
                for (InjectionTarget injectionTarget : targets)
                {
                    injectionEngine.inject(instance, injectionTarget, null);
                }
            }
        }

        return instance;
    }
public static Object createInjectedInstance ( Class < ? > targetClass , HashMap < Class < ? > , InjectionTarget [ ] > injectionTargetMap ) throws InjectionException , IllegalAccessException , InstantiationException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "createInjectedInstance : " + targetClass + ", " + ( injectionTargetMap == null ? "null" : Util . identity ( injectionTargetMap . get ( targetClass ) ) ) ) ; InjectionTarget [ ] targets = null ; Object instance = targetClass . newInstance ( ) ; if ( injectionTargetMap != null ) { targets = injectionTargetMap . get ( targetClass ) ; if ( targets != null ) { InjectionEngine injectionEngine = InjectionEngineAccessor . getInstance ( ) ; for ( InjectionTarget injectionTarget : targets ) { injectionEngine . inject ( instance , injectionTarget , null ) ; } } } return instance ; }
Creates an instance of the target class, and performs all
dependency injection present in the specified injection
target map. <p>

An InjectionException will be thrown if the specified
injection cannot be performed. <p>

@param targetClass Class of the object to be created.
@param injectionTargetMap Map of injection targets, per class.

@return an injected instance of the target class.

@exception InjectionException occurs when the specified dependency
injection has either not been configured properly, or
for any other reason cannot be completed.
@exception IllegalAccessException if the class or its nullary constructor
is not accessible.
@exception InstantiationException if this Class represents an abstract
class, an interface, an array class, a primitive type,
or void; or if the class has no nullary constructor; or
if the instantiation fails for some other reason.
@exception ExceptionInInitializerError if the initialization provoked
by this method fails.
@exception SecurityException if a security manager, s, is present and
any of the following conditions is met:
<ul>
<li> invocation of s.checkMemberAccess(this, Member.PUBLIC)
denies creation of new instances of this class.
<li> the caller's class loader is not the same as or an
ancestor of the class loader for the current class and
invocation of s.checkPackageAccess() denies access to
the package of this class.
</ul>