alexandrage / EmptyConstructorHack

Allows to create objects without invoking constructor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EmptyConstructorHack

Allows you to create objects without invoking constructor

To get some code examples check test files.

        AsmClassGenerator generator = new AsmClassGenerator(SafeClassDefiner.getInstance());
        EmptyConstructorCreator creator = generator.newClassInstanceManipulator(ClassWithConstructor.class);
        ClassWithConstructor o = (ClassWithConstructor) creator.newInstance();

And you are done.

Be aware that creating 'EmptyConstructorCreator' is a heavy operation and should be done only once per class.

About

Allows to create objects without invoking constructor


Languages

Language:Java 100.0%