@ComponentSpecification public interface PojoFactory
create new instances of
Pojos. Pojo has a public non-arg constructor. However there can be arbitrary
reasons why Class.newInstance() might NOT do it and you want some abstraction like this interface. Here are
just a few of them.
Class is an interface such as List.Class does not have a non-arg constructor.Class.newInstance() is throwing ugly checked exceptions.Class.PojoFactory. You might want to hide
objenesis behind this interface to combine its features with the
power of mmm.| Modifier and Type | Method and Description |
|---|---|
<POJO> POJO |
newInstance(Class<POJO> pojoType)
This method creates a new instance of the given
pojoType. |
<POJO> POJO newInstance(Class<POJO> pojoType) throws InstantiationFailedException
pojoType. 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.POJO - is the generic type of the Pojo to create.pojoType - is the Class reflecting the Pojo to create.pojoType.InstantiationFailedException - if the instantiation failed.Copyright © 2001–2016 mmm-Team. All rights reserved.