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

com.github.romanqed.jeflect.loader.ObjectFactory Maven / Gradle / Ivy

The newest version!
package com.github.romanqed.jeflect.loader;

import com.github.romanqed.jfunc.Function1;

import java.util.concurrent.Callable;

/**
 * An interface describing a universal define factory for proxy objects.
 *
 * @param  type of produced objects
 */
public interface ObjectFactory {

    /**
     * Creates a class object with the specified name,
     * and if there are no loaded classes in the pool,
     * creates it from bytes received from the specified provider.
     *
     * @param name     class name
     * @param provider a byte code generator used in the absence of a class
     * @param creator  a function that creates a class object
     * @return created object
     * @throws RuntimeException if there are problems during the search, generation or instantiation of the class
     */
    T create(String name, Callable provider, Function1, ? extends T> creator);

    /**
     * Creates a class object with the specified name,
     * and if there are no loaded classes in the pool,
     * creates it from bytes received from the specified provider.
     *
     * @param name     class name
     * @param provider a byte code generator used in the absence of a class
     * @return created object
     * @throws RuntimeException if there are problems during the search, generation or instantiation of the class
     */
    T create(String name, Callable provider);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy