com.github.romanqed.jeflect.loader.ObjectFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jeflect-loader Show documentation
Show all versions of jeflect-loader Show documentation
A mechanism for loading bytecode classes
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);
}