SpinMess - 2017-11-07

I would like to be able to use BeanTester() for Beans lacking a no-argument constructor. I haven't been able to find a hack to do this without editing your code, but I think it would be a small modification to build in the capability:

Reading through the code, it seems https://sourceforge.net/p/meanbean/code/HEAD/tree/trunk/src/main/java/org/meanbean/test/BeanTester.java could be modified inside

testBean(BeanInformation beanInformation, Configuration configuration)

replacing line 397

BasicNewObjectInstanceFactory beanFactory = new BasicNewObjectInstanceFactory(beanInformation.getBeanClass());

with something similar to the following

Class beanClass = beanInformation.getBeanClass();
Factory beanFactory;
if (hasCustomConfiguration(beanClass)) {
    beanFactory = factoryCollection.getFactory(beanClass);
}
else {
    beanFactory = new BasicNewObjectInstanceFactory(beanClass);
}

I could then make a custom factory for my TargetClass using BeanTester().getFactoryCollection().addFactory(TargetClass.class, TargetClassFactory())

Thoughts? Would this work? Are there similar changes planned for the near future?
Also, I'm new to SourceForge/svn, though I've used GitHub/git a bit more. Should I make a pull request?
Thanks.

 

Last edit: SpinMess 2017-11-07