info.magnolia.objectfactory
Class DefaultClassFactory

java.lang.Object
  extended by info.magnolia.objectfactory.DefaultClassFactory
All Implemented Interfaces:
ClassFactory

public class DefaultClassFactory
extends Object
implements ClassFactory

A ClassFactory implementation which uses the default class loader and the thread context class loader.

Version:
$Revision: $ ($Author: $)
Author:
gjoseph

Constructor Summary
DefaultClassFactory()
           
 
Method Summary
<C> Class<C>
forName(String className)
           
<T> T
newInstance(Class<T> c, Class<?>[] argTypes, Object... params)
          Instantiates the given class with the given parameters, using a constructor that matches the given argTypes exactly.
<T> T
newInstance(Class<T> c, Object... params)
          Instantiates the given class with the given parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultClassFactory

public DefaultClassFactory()
Method Detail

forName

public <C> Class<C> forName(String className)
                 throws ClassNotFoundException
Specified by:
forName in interface ClassFactory
Throws:
ClassNotFoundException

newInstance

public <T> T newInstance(Class<T> c,
                         Class<?>[] argTypes,
                         Object... params)
Description copied from interface: ClassFactory
Instantiates the given class with the given parameters, using a constructor that matches the given argTypes exactly. To pass "null" to a single-arg constructor, use newInstance(c, new Object[]{null}) (otherwise the *array* itself will be considered null)

Specified by:
newInstance in interface ClassFactory

newInstance

public <T> T newInstance(Class<T> c,
                         Object... params)
Description copied from interface: ClassFactory
Instantiates the given class with the given parameters. This attempts to find a matching constructor. For the empty constructor, pass no parameters (or an empty array, or null). Null arguments are not supported.

Specified by:
newInstance in interface ClassFactory


Copyright © 2003–2014 Magnolia International Ltd.. All rights reserved.