net.sf.mmm.util.pojo.base
Class SimplePojoFactory
java.lang.Object
net.sf.mmm.util.component.base.AbstractComponent
net.sf.mmm.util.component.base.AbstractLoggableComponent
net.sf.mmm.util.pojo.base.SimplePojoFactory
- All Implemented Interfaces:
- PojoFactory
- Direct Known Subclasses:
- DefaultPojoFactory
public class SimplePojoFactory
- extends AbstractLoggableComponent
- implements PojoFactory
This is the simplest implementation of the PojoFactory interface.
It uses Class.newInstance() to create new
instances.
- Since:
- 1.1.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimplePojoFactory
public SimplePojoFactory()
newInstance
public <POJO> POJO newInstance(Class<POJO> pojoType)
throws InstantiationFailedException
- This method creates a new instance of the given
pojoType.
The simplest implementation may just delegate to
Class.newInstance(). However implementations can solve arbitrary
problems such as if the given pojoType has no non-arg
constructor, or it is an interface or abstract class.
- Specified by:
newInstance in interface PojoFactory
- Type Parameters:
POJO - is the generic type of the
Pojo to create.- Parameters:
pojoType - is the Class reflecting the
Pojo to create.
- Returns:
- the new instance of the given
pojoType.
- Throws:
InstantiationFailedException - if the instantiation failed.
newInstanceForClass
protected <POJO> POJO newInstanceForClass(Class<POJO> pojoType)
throws InstantiationFailedException
- Implementation of
newInstance(Class) for regular class.
- Type Parameters:
POJO - is the generic type of the
Pojo to create.- Parameters:
pojoType - is the Class reflecting the
Pojo to create.
- Returns:
- the new instance of the given
pojoType.
- Throws:
InstantiationFailedException - if the instantiation failed.
newInstanceForInterface
protected <POJO> POJO newInstanceForInterface(Class<POJO> pojoInterface)
throws InstantiationFailedException
- This method is invoked from
newInstance(Class) if the given
Class is an interface.
- Type Parameters:
POJO - is the generic type of the
Pojo to create.- Parameters:
pojoInterface - is the interface reflecting the
Pojo to create.
- Returns:
- the new instance of the given
pojoType or
null if no implementation could be found.
- Throws:
InstantiationFailedException - if the instantiation failed.
Copyright © 2001-2010 mmm-Team. All Rights Reserved.