Class PublicNoArgsConstructorInstanceFactory
java.lang.Object
de.danielbechler.diff.instantiation.PublicNoArgsConstructorInstanceFactory
- All Implemented Interfaces:
InstanceFactory
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
PublicNoArgsConstructorInstanceFactory
public PublicNoArgsConstructorInstanceFactory()
-
-
Method Details
-
newInstanceOfType
- Specified by:
newInstanceOfTypein interfaceInstanceFactory- Parameters:
type- The type for which a new instance should be created- Returns:
- A new instance of the given
typeornullif it doesn't know how to instantiate the type. In case of the latter, theObjectDifferwill automatically fallback to instantiation via public non-arg constructor. If that also fails, anTypeInstantiationExceptionwill be thrown. Note from the author: it wasn't an easy decision, but in the end I favored an exception over logging a warning, because this way it is much harder to accidentally end up with incomplete merges without noticing. If this turns out to be a problem for you, please let me know in the issue tracker. We could probably add a flag to switch to the logging-only mode. But as long as nobody complains, I'll just leave it as it is right now.
-