All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fluentinterface.proxy.internal.EmptyConstructor Maven / Gradle / Ivy

The newest version!
package com.fluentinterface.proxy.internal;

import com.fluentinterface.proxy.BuilderState;
import com.fluentinterface.proxy.Instantiator;

/**
 * Instantiates an object using its default empty constructor.
 */
class EmptyConstructor implements Instantiator {
    private Class targetClass;

    EmptyConstructor(Class targetClass) {
        this.targetClass = targetClass;
    }

    @Override
    public T instantiate(BuilderState state) throws InstantiationException {
        try {
            return targetClass.newInstance();
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy