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

org.revenj.extensibility.PluginLoader Maven / Gradle / Ivy

The newest version!
package org.revenj.extensibility;

import java.lang.reflect.GenericArrayType;
import java.lang.reflect.Type;
import java.util.List;

public interface PluginLoader {
	 List> find(Class manifest, Type... types) throws Exception;

	@SuppressWarnings("unchecked")
	default  T[] resolve(Container container, Class manifest) throws Exception {
		try (Container scope = container.createScope()) {
			List> manifests = find(manifest);
			for (Class sc : manifests) {
				scope.registerType(manifest, sc, InstanceScope.CONTEXT);
			}
			return (T[]) scope.resolve((GenericArrayType) () -> manifest);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy