io.qt.core.internal.QFactoryLoader Maven / Gradle / Ivy
Show all versions of qtjambi Show documentation
package io.qt.core.internal;
import io.qt.*;
import io.qt.core.*;
import java.lang.reflect.*;
import java.util.logging.*;
/**
* Java wrapper for Qt class QFactoryLoader
*/
public class QFactoryLoader extends io.qt.core.QObject
{
static {
QtJambi_LibraryUtilities.initialize();
}
/**
* This variable stores the meta-object for the class.
*/
public static final io.qt.core.@NonNull QMetaObject staticMetaObject = io.qt.core.QMetaObject.forType(QFactoryLoader.class);
/**
* See QFactoryLoader:: QFactoryLoader(const char*, QString, Qt::CaseSensitivity)
*/
public QFactoryLoader(java.lang.@StrictNonNull Class extends QtObjectInterface> iid, java.lang.@NonNull String suffix, io.qt.core.Qt.@NonNull CaseSensitivity arg__3){
super((QPrivateConstructor)null);
QtUtilities.initializePackage(iid);
if(suffix==null || !suffix.startsWith("/"))
throw new IllegalArgumentException("For historical reasons, the suffix must start with '/' (and it can't be empty)");
java.util.Objects.requireNonNull(iid, "Argument 'iid': null not expected.");
initialize_native(this, iid, suffix, arg__3);
}
private native static void initialize_native(QFactoryLoader instance, java.lang.Class extends QtObjectInterface> iid, java.lang.String suffix, io.qt.core.Qt.CaseSensitivity arg__3);
/**
* See QFactoryLoader:: indexOf(QString)const
*/
@QtUninvokable
public final int indexOf(java.lang.@NonNull String needle){
return indexOf_native_cref_QString_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), needle);
}
@QtUninvokable
private native int indexOf_native_cref_QString_constfct(long __this__nativeId, java.lang.String needle);
/**
* See QFactoryLoader:: instance(int)const
*/
@QtUninvokable
public final io.qt.core.@Nullable QObject instance(int index){
return instance_native_int_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), index);
}
@QtUninvokable
private native io.qt.core.QObject instance_native_int_constfct(long __this__nativeId, int index);
/**
* See QFactoryLoader:: keyMap()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QMultiMap keyMap(){
return keyMap_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QMultiMap keyMap_native_constfct(long __this__nativeId);
/**
* See QFactoryLoader:: metaData()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QList metaData(){
return metaData_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QList metaData_native_constfct(long __this__nativeId);
/**
* See QFactoryLoader:: metaDataKeys()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QList metaDataKeys(){
return metaDataKeys_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QList metaDataKeys_native_constfct(long __this__nativeId);
/**
* See QFactoryLoader:: setExtraSearchPath(QString)
*/
@QtUninvokable
public final void setExtraSearchPath(java.lang.@NonNull String path){
setExtraSearchPath_native_cref_QString(QtJambi_LibraryUtilities.internal.nativeId(this), path);
}
@QtUninvokable
private native void setExtraSearchPath_native_cref_QString(long __this__nativeId, java.lang.String path);
/**
* See QFactoryLoader:: update()
*/
@QtUninvokable
public final void update(){
update_native(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native void update_native(long __this__nativeId);
/**
* See QFactoryLoader:: refreshAll()
*/
public native static void refreshAll();
/**
* Constructor for internal use only.
* @param p expected to be null
.
* @hidden
*/
@NativeAccess
protected QFactoryLoader(QPrivateConstructor p) { super(p); }
public static void registerFactory(Class extends QtObjectInterface> factoryClass){
Method createMethod = null;
for(Method method : factoryClass.getDeclaredMethods()) {
if(!Modifier.isStatic(method.getModifiers())
&& Modifier.isPublic(method.getModifiers())
&& method.getReturnType()!=void.class) {
createMethod = method;
break;
}
}
if(createMethod==null) {
throw new IllegalArgumentException("Missing factory method in interface "+factoryClass.getName());
}
QPluginLoader.qRegisterPluginInterface(factoryClass);
}
public R loadPlugin(QMetaObject.Method2
create, String key) {
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class
factoryClass = io.qt.internal.ClassAnalyzerUtility.getFactoryClass(create);
if(factoryClass!=null && factoryClass==registeredPluginInterface(iidValue.toString())) {
QObject factoryObject = instance(index);
P factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
try {
return create.invoke(factory, key);
} catch (RuntimeException | Error ex) {
throw ex;
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}else if(factoryClass==null && io.qt.core.QOperatingSystemVersion.current().isAnyOfType(io.qt.core.QOperatingSystemVersion.OSType.Android)) {
QObject factoryObject = instance(index);
@SuppressWarnings("unchecked")
P factory = (P)factoryObject;
if(factory!=null){
try {
return create.invoke(factory, key);
} catch (Throwable ex) {
return null;
}
}
}
}
}
return null;
}
public
R loadPlugin(QMetaObject.Method3
create, String key, A a) {
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class
factoryClass = io.qt.internal.ClassAnalyzerUtility.getFactoryClass(create);
if(factoryClass!=null && factoryClass==registeredPluginInterface(iidValue.toString())) {
QObject factoryObject = instance(index);
P factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
try {
return create.invoke(factory, key, a);
} catch (RuntimeException | Error ex) {
throw ex;
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}else if(factoryClass==null && io.qt.core.QOperatingSystemVersion.current().isAnyOfType(io.qt.core.QOperatingSystemVersion.OSType.Android)) {
QObject factoryObject = instance(index);
@SuppressWarnings("unchecked")
P factory = (P)factoryObject;
if(factory!=null){
try {
return create.invoke(factory, key, a);
} catch (Throwable ex) {
return null;
}
}
}
}
}
return null;
}
public
R loadPlugin(QMetaObject.Method4
create, String key, A a, B b) {
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class
factoryClass = io.qt.internal.ClassAnalyzerUtility.getFactoryClass(create);
if(factoryClass!=null && factoryClass==registeredPluginInterface(iidValue.toString())) {
QObject factoryObject = instance(index);
P factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
try {
return create.invoke(factory, key, a, b);
} catch (RuntimeException | Error ex) {
throw ex;
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}else if(factoryClass==null && io.qt.core.QOperatingSystemVersion.current().isAnyOfType(io.qt.core.QOperatingSystemVersion.OSType.Android)) {
QObject factoryObject = instance(index);
@SuppressWarnings("unchecked")
P factory = (P)factoryObject;
if(factory!=null){
try {
return create.invoke(factory, key, a, b);
} catch (Throwable ex) {
return null;
}
}
}
}
}
return null;
}
public
R loadPlugin(QMetaObject.Method5
create, String key, A a, B b, C c) {
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class
factoryClass = io.qt.internal.ClassAnalyzerUtility.getFactoryClass(create);
if(factoryClass!=null && factoryClass==registeredPluginInterface(iidValue.toString())) {
QObject factoryObject = instance(index);
P factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
try {
return create.invoke(factory, key, a, b, c);
} catch (RuntimeException | Error ex) {
throw ex;
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}else if(factoryClass==null && io.qt.core.QOperatingSystemVersion.current().isAnyOfType(io.qt.core.QOperatingSystemVersion.OSType.Android)) {
QObject factoryObject = instance(index);
@SuppressWarnings("unchecked")
P factory = (P)factoryObject;
if(factory!=null){
try {
return create.invoke(factory, key, a, b, c);
} catch (Throwable ex) {
return null;
}
}
}
}
}
return null;
}
public
R loadPlugin(QMetaObject.Method6
create, String key, A a, B b, C c, D d) {
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class
factoryClass = io.qt.internal.ClassAnalyzerUtility.getFactoryClass(create);
if(factoryClass!=null && factoryClass==registeredPluginInterface(iidValue.toString())) {
QObject factoryObject = instance(index);
P factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
try {
return create.invoke(factory, key, a, b, c, d);
} catch (RuntimeException | Error ex) {
throw ex;
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}else if(factoryClass==null && io.qt.core.QOperatingSystemVersion.current().isAnyOfType(io.qt.core.QOperatingSystemVersion.OSType.Android)) {
QObject factoryObject = instance(index);
@SuppressWarnings("unchecked")
P factory = (P)factoryObject;
if(factory!=null){
try {
return create.invoke(factory, key, a, b, c, d);
} catch (Throwable ex) {
return null;
}
}
}
}
}
return null;
}
public
R loadPlugin(QMetaObject.Method7
create, String key, A a, B b, C c, D d, E e) {
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class
factoryClass = io.qt.internal.ClassAnalyzerUtility.getFactoryClass(create);
if(factoryClass!=null && factoryClass==registeredPluginInterface(iidValue.toString())) {
QObject factoryObject = instance(index);
P factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
try {
return create.invoke(factory, key, a, b, c, d, e);
} catch (RuntimeException | Error ex) {
throw ex;
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}else if(factoryClass==null && io.qt.core.QOperatingSystemVersion.current().isAnyOfType(io.qt.core.QOperatingSystemVersion.OSType.Android)) {
QObject factoryObject = instance(index);
@SuppressWarnings("unchecked")
P factory = (P)factoryObject;
if(factory!=null){
try {
return create.invoke(factory, key, a, b, c, d, e);
} catch (Throwable ex) {
return null;
}
}
}
}
}
return null;
}
public
R loadPlugin(QMetaObject.Method8
create, String key, A a, B b, C c, D d, E e, F f) {
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class
factoryClass = io.qt.internal.ClassAnalyzerUtility.getFactoryClass(create);
if(factoryClass!=null && factoryClass==registeredPluginInterface(iidValue.toString())) {
QObject factoryObject = instance(index);
P factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
try {
return create.invoke(factory, key, a, b, c, d, e, f);
} catch (RuntimeException | Error ex) {
throw ex;
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}else if(factoryClass==null && io.qt.core.QOperatingSystemVersion.current().isAnyOfType(io.qt.core.QOperatingSystemVersion.OSType.Android)) {
QObject factoryObject = instance(index);
@SuppressWarnings("unchecked")
P factory = (P)factoryObject;
if(factory!=null){
try {
return create.invoke(factory, key, a, b, c, d, e, f);
} catch (Throwable ex) {
return null;
}
}
}
}
}
return null;
}
public
R loadPlugin(QMetaObject.Method9
create, String key, A a, B b, C c, D d, E e, F f, G g) {
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class
factoryClass = io.qt.internal.ClassAnalyzerUtility.getFactoryClass(create);
if(factoryClass!=null && factoryClass==registeredPluginInterface(iidValue.toString())) {
QObject factoryObject = instance(index);
P factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
try {
return create.invoke(factory, key, a, b, c, d, e, f, g);
} catch (RuntimeException | Error ex) {
throw ex;
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}else if(factoryClass==null && io.qt.core.QOperatingSystemVersion.current().isAnyOfType(io.qt.core.QOperatingSystemVersion.OSType.Android)) {
QObject factoryObject = instance(index);
@SuppressWarnings("unchecked")
P factory = (P)factoryObject;
if(factory!=null){
try {
return create.invoke(factory, key, a, b, c, d, e, f, g);
} catch (Throwable ex) {
return null;
}
}
}
}
}
return null;
}
public
R loadPlugin(QMetaObject.Method1
create, String key) {
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class
factoryClass = io.qt.internal.ClassAnalyzerUtility.getFactoryClass(create);
if(factoryClass!=null && factoryClass==registeredPluginInterface(iidValue.toString())) {
QObject factoryObject = instance(index);
P factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
try {
return create.invoke(factory);
} catch (Throwable e) {
Logger.getLogger(QFactoryLoader.class.getName()).throwing(QFactoryLoader.class.getName(), "loadPlugin", e);
}
}
}else if(factoryClass==null && io.qt.core.QOperatingSystemVersion.current().isAnyOfType(io.qt.core.QOperatingSystemVersion.OSType.Android)) {
QObject factoryObject = instance(index);
@SuppressWarnings("unchecked")
P factory = (P)factoryObject;
if(factory!=null){
try {
return create.invoke(factory);
} catch (Throwable ex) {
return null;
}
}
}
}
}
return null;
}
public
R loadPlugin(QMetaObject.Method2
create, String key, A a) {
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class
factoryClass = io.qt.internal.ClassAnalyzerUtility.getFactoryClass(create);
if(factoryClass!=null && factoryClass==registeredPluginInterface(iidValue.toString())) {
QObject factoryObject = instance(index);
P factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
try {
return create.invoke(factory, a);
} catch (RuntimeException | Error ex) {
throw ex;
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}else if(factoryClass==null && io.qt.core.QOperatingSystemVersion.current().isAnyOfType(io.qt.core.QOperatingSystemVersion.OSType.Android)) {
QObject factoryObject = instance(index);
@SuppressWarnings("unchecked")
P factory = (P)factoryObject;
if(factory!=null){
try {
return create.invoke(factory, a);
} catch (Throwable ex) {
return null;
}
}
}
}
}
return null;
}
public
R loadPlugin(QMetaObject.Method3
create, String key, A a, B b) {
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class
factoryClass = io.qt.internal.ClassAnalyzerUtility.getFactoryClass(create);
if(factoryClass!=null && factoryClass==registeredPluginInterface(iidValue.toString())) {
QObject factoryObject = instance(index);
P factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
try {
return create.invoke(factory, a, b);
} catch (RuntimeException | Error ex) {
throw ex;
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}else if(factoryClass==null && io.qt.core.QOperatingSystemVersion.current().isAnyOfType(io.qt.core.QOperatingSystemVersion.OSType.Android)) {
QObject factoryObject = instance(index);
@SuppressWarnings("unchecked")
P factory = (P)factoryObject;
if(factory!=null){
try {
return create.invoke(factory, a, b);
} catch (Throwable ex) {
return null;
}
}
}
}
}
return null;
}
public
R loadPlugin(QMetaObject.Method4
create, String key, A a, B b, C c) {
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class
factoryClass = io.qt.internal.ClassAnalyzerUtility.getFactoryClass(create);
if(factoryClass!=null && factoryClass==registeredPluginInterface(iidValue.toString())) {
QObject factoryObject = instance(index);
P factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
try {
return create.invoke(factory, a, b, c);
} catch (RuntimeException | Error ex) {
throw ex;
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}else if(factoryClass==null && io.qt.core.QOperatingSystemVersion.current().isAnyOfType(io.qt.core.QOperatingSystemVersion.OSType.Android)) {
QObject factoryObject = instance(index);
@SuppressWarnings("unchecked")
P factory = (P)factoryObject;
if(factory!=null){
try {
return create.invoke(factory, a, b, c);
} catch (Throwable ex) {
return null;
}
}
}
}
}
return null;
}
public
R loadPlugin(QMetaObject.Method5
create, String key, A a, B b, C c, D d) {
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class
factoryClass = io.qt.internal.ClassAnalyzerUtility.getFactoryClass(create);
if(factoryClass!=null && factoryClass==registeredPluginInterface(iidValue.toString())) {
QObject factoryObject = instance(index);
P factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
try {
return create.invoke(factory, a, b, c, d);
} catch (RuntimeException | Error ex) {
throw ex;
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}else if(factoryClass==null && io.qt.core.QOperatingSystemVersion.current().isAnyOfType(io.qt.core.QOperatingSystemVersion.OSType.Android)) {
QObject factoryObject = instance(index);
@SuppressWarnings("unchecked")
P factory = (P)factoryObject;
if(factory!=null){
try {
return create.invoke(factory, a, b, c, d);
} catch (Throwable ex) {
return null;
}
}
}
}
}
return null;
}
public
R loadPlugin(QMetaObject.Method6
create, String key, A a, B b, C c, D d, E e) {
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class
factoryClass = io.qt.internal.ClassAnalyzerUtility.getFactoryClass(create);
if(factoryClass!=null && factoryClass==registeredPluginInterface(iidValue.toString())) {
QObject factoryObject = instance(index);
P factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
try {
return create.invoke(factory, a, b, c, d, e);
} catch (RuntimeException | Error ex) {
throw ex;
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}else if(factoryClass==null && io.qt.core.QOperatingSystemVersion.current().isAnyOfType(io.qt.core.QOperatingSystemVersion.OSType.Android)) {
QObject factoryObject = instance(index);
@SuppressWarnings("unchecked")
P factory = (P)factoryObject;
if(factory!=null){
try {
return create.invoke(factory, a, b, c, d, e);
} catch (Throwable ex) {
return null;
}
}
}
}
}
return null;
}
public
R loadPlugin(QMetaObject.Method7
create, String key, A a, B b, C c, D d, E e, F f) {
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class
factoryClass = io.qt.internal.ClassAnalyzerUtility.getFactoryClass(create);
if(factoryClass!=null && factoryClass==registeredPluginInterface(iidValue.toString())) {
QObject factoryObject = instance(index);
P factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
try {
return create.invoke(factory, a, b, c, d, e, f);
} catch (RuntimeException | Error ex) {
throw ex;
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}else if(factoryClass==null && io.qt.core.QOperatingSystemVersion.current().isAnyOfType(io.qt.core.QOperatingSystemVersion.OSType.Android)) {
QObject factoryObject = instance(index);
@SuppressWarnings("unchecked")
P factory = (P)factoryObject;
if(factory!=null){
try {
return create.invoke(factory, a, b, c, d, e, f);
} catch (Throwable ex) {
return null;
}
}
}
}
}
return null;
}
public
R loadPlugin(QMetaObject.Method8
create, String key, A a, B b, C c, D d, E e, F f, G g) {
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class
factoryClass = io.qt.internal.ClassAnalyzerUtility.getFactoryClass(create);
if(factoryClass!=null && factoryClass==registeredPluginInterface(iidValue.toString())) {
QObject factoryObject = instance(index);
P factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
try {
return create.invoke(factory, a, b, c, d, e, f, g);
} catch (RuntimeException | Error ex) {
throw ex;
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}else if(factoryClass==null && io.qt.core.QOperatingSystemVersion.current().isAnyOfType(io.qt.core.QOperatingSystemVersion.OSType.Android)) {
QObject factoryObject = instance(index);
@SuppressWarnings("unchecked")
P factory = (P)factoryObject;
if(factory!=null){
try {
return create.invoke(factory, a, b, c, d, e, f, g);
} catch (Throwable ex) {
return null;
}
}
}
}
}
return null;
}
public
R loadPlugin(QMetaObject.Method9
create, String key, A a, B b, C c, D d, E e, F f, G g, H h) {
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class
factoryClass = io.qt.internal.ClassAnalyzerUtility.getFactoryClass(create);
if(factoryClass!=null && factoryClass==registeredPluginInterface(iidValue.toString())) {
QObject factoryObject = instance(index);
P factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
try {
return create.invoke(factory, a, b, c, d, e, f, g, h);
} catch (RuntimeException | Error ex) {
throw ex;
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}else if(factoryClass==null && io.qt.core.QOperatingSystemVersion.current().isAnyOfType(io.qt.core.QOperatingSystemVersion.OSType.Android)) {
QObject factoryObject = instance(index);
@SuppressWarnings("unchecked")
P factory = (P)factoryObject;
if(factory!=null){
try {
return create.invoke(factory, a, b, c, d, e, f, g, h);
} catch (Throwable ex) {
return null;
}
}
}
}
}
return null;
}
public QObject loadPlugin(String key, Object... args){
return loadPlugin(QObject.class, key, args);
}
public
P loadPlugin(Class
pluginClass, String key, Object... args){
int index = indexOf(key);
if (index != -1) {
QJsonValue iidValue = getIID(index);
if(iidValue.isString()) {
Class extends QtObjectInterface> factoryClass = registeredPluginInterface(iidValue.toString());
if(factoryClass!=null) {
QObject factoryObject = instance(index);
QtObjectInterface factory = QMetaObject.cast(factoryClass, factoryObject);
if(factory!=null){
Method createMethod = null;
for(Method method : factoryClass.getDeclaredMethods()) {
Class>[] argClassTypes = method.getParameterTypes();
if(argClassTypes.length==args.length
&& !Modifier.isStatic(method.getModifiers())
&& Modifier.isPublic(method.getModifiers())
&& pluginClass==method.getReturnType()) {
createMethod = method;
for (int i = 0; i < method.getParameterCount(); i++) {
Class> argClassType = argClassTypes[i];
if(argClassType.isPrimitive()) {
if(args[i]==null
|| (argClassType==int.class && !(args[i] instanceof Integer))
|| (argClassType==short.class && !(args[i] instanceof Short))
|| (argClassType==byte.class && !(args[i] instanceof Byte))
|| (argClassType==long.class && !(args[i] instanceof Long))
|| (argClassType==boolean.class && !(args[i] instanceof Boolean))
|| (argClassType==float.class && !(args[i] instanceof Float))
|| (argClassType==char.class && !(args[i] instanceof Character))
|| (argClassType==double.class && !(args[i] instanceof Double))
) {
createMethod = null;
break;
}
}else if(args[i]!=null && !argClassType.isInstance(args[i])){
createMethod = null;
break;
}
}
if(createMethod!=null)
break;
}else if(argClassTypes.length==args.length+1
&& argClassTypes[0]==String.class
&& !Modifier.isStatic(method.getModifiers())
&& Modifier.isPublic(method.getModifiers())
&& pluginClass==method.getReturnType()) {
createMethod = method;
for (int i = 0; i <= method.getParameterCount(); i++) {
Class> argClassType = argClassTypes[i+1];
if(argClassType.isPrimitive()) {
if(args[i]==null
|| (argClassType==int.class && !(args[i] instanceof Integer))
|| (argClassType==short.class && !(args[i] instanceof Short))
|| (argClassType==byte.class && !(args[i] instanceof Byte))
|| (argClassType==long.class && !(args[i] instanceof Long))
|| (argClassType==boolean.class && !(args[i] instanceof Boolean))
|| (argClassType==float.class && !(args[i] instanceof Float))
|| (argClassType==char.class && !(args[i] instanceof Character))
|| (argClassType==double.class && !(args[i] instanceof Double))
) {
createMethod = null;
break;
}
}else if(args[i]!=null && !argClassType.isInstance(args[i])){
createMethod = null;
break;
}
}
if(createMethod!=null)
break;
}
}
if(createMethod!=null) {
try {
Object result;
if(createMethod.getParameterCount()==args.length+1) {
Object[] _args = new Object[args.length+1];
System.arraycopy(args, 0, _args, 1, args.length);
_args[0] = key;
result = QtJambi_LibraryUtilities.internal.invokeMethod(createMethod, factory, _args);
}else {
result = QtJambi_LibraryUtilities.internal.invokeMethod(createMethod, factory, args);
}
if(pluginClass.isInterface() && result instanceof QObject) {
return QMetaObject.cast(pluginClass, (QObject)result);
}else if(result!=null){
return pluginClass.cast(result);
}
} catch (RuntimeException | Error ex) {
throw ex;
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}
}
}
}
return null;
}
private static native Class extends QtObjectInterface> registeredPluginInterface(String iid);
private @NonNull QJsonValue getIID(int index){
return metaData().get(index).toCbor().value(QtPluginMetaDataKeys.IID.value()).toJsonValue();
}
/**
*
Overloaded constructor for {@link #QFactoryLoader(java.lang.Class, java.lang.String, io.qt.core.Qt.CaseSensitivity)}
* with arg__3 = io.qt.core.Qt.CaseSensitivity.CaseSensitive
.
*/
public QFactoryLoader(java.lang.@StrictNonNull Class extends QtObjectInterface> iid, java.lang.@NonNull String suffix) {
this(iid, suffix, io.qt.core.Qt.CaseSensitivity.CaseSensitive);
}
/**
* Overloaded constructor for {@link #QFactoryLoader(java.lang.Class, java.lang.String, io.qt.core.Qt.CaseSensitivity)}
* with:
* suffix = (String)null
* arg__3 = io.qt.core.Qt.CaseSensitivity.CaseSensitive
*
*/
public QFactoryLoader(java.lang.@StrictNonNull Class extends QtObjectInterface> iid) {
this(iid, (String)null, io.qt.core.Qt.CaseSensitivity.CaseSensitive);
}
}