io.qt.core.QMetaObject Maven / Gradle / Ivy
Show all versions of qtjambi Show documentation
/****************************************************************************
**
** Copyright (C) 2009-2024 Dr. Peter Droste, Omix Visualization GmbH & Co. KG. All rights reserved.
**
** This file is part of Qt Jambi.
**
** $BEGIN_LICENSE$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
** $END_LICENSE$
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
package io.qt.core;
import static io.qt.core.QMetaMethod.fromReflectedMethod;
import static io.qt.internal.MetaTypeUtility.internalNameOfArgumentType;
import static io.qt.internal.MetaTypeUtility.internalTypeName;
import static io.qt.internal.MetaTypeUtility.internalTypeNameOfClass;
import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Parameter;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Proxy;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.logging.Level;
import java.util.logging.Logger;
import io.qt.NonNull;
import io.qt.Nullable;
import io.qt.QFlags;
import io.qt.QNoDefaultValueException;
import io.qt.QNoSuchMethodException;
import io.qt.QNoSuchSlotException;
import io.qt.QUnsuccessfulInvocationException;
import io.qt.QtAbstractEnumerator;
import io.qt.QtEnumerator;
import io.qt.QtGadget;
import io.qt.QtObjectInterface;
import io.qt.QtSignalEmitterInterface;
import io.qt.QtThreadAffineInterface;
import io.qt.QtUninvokable;
import io.qt.StrictNonNull;
import io.qt.internal.ClassAnalyzerUtility;
/**
* Java wrapper for Qt class QMetaObject
*/
public final class QMetaObject {
static {
QtJambi_LibraryUtilities.initialize();
}
private static final char SlotPrefix = '1';
private static final char SignalPrefix = '2';
@Override
public String toString() {
return metaObjectPointer==0 ? super.toString() : "QMetaObject(" + className() + ")";
}
private static class EnumEntries{
EnumEntries(QtEnumerator[] entries) {
super();
this.entries = entries;
}
final QtEnumerator[] entries;
private Map enumConstantDirectory;
private Map enumeratorConstantDirectory;
@QtUninvokable
Map enumConstantDirectory() {
if(enumConstantDirectory==null) {
enumConstantDirectory = new TreeMap<>();
for(QtEnumerator entry : entries) {
enumConstantDirectory.put(entry.name(), entry);
}
}
return enumConstantDirectory;
}
@QtUninvokable
Map enumeratorConstantDirectory() {
if(enumConstantDirectory==null) {
enumeratorConstantDirectory = new TreeMap<>();
for(QtEnumerator entry : entries) {
if(!enumeratorConstantDirectory.containsKey(entry.value()))
enumeratorConstantDirectory.put(entry.value(), entry);
}
}
return enumeratorConstantDirectory;
}
}
private static final Class> flagsWrapperClass;
static {
Class> flagsClass = null;
for(Class> cls : QFlags.class.getDeclaredClasses()) {
if(QFlags.class.isAssignableFrom(cls) && !Modifier.isAbstract(cls.getModifiers())) {
flagsClass = cls;
}
}
flagsWrapperClass = flagsClass;
}
final long metaObjectPointer;
private Class>[] enumClasses;
private Map enumEntries;
private QMetaObject(long metaObjectPointer) {
this.metaObjectPointer = metaObjectPointer;
}
@QtUninvokable
synchronized Class> enumType(QMetaEnum enumerator){
if(enumClasses==null)
enumClasses = new Class[enumeratorCount(metaObjectPointer)];
if(enumClasses[enumeratorIndex(enumerator)]==null) {
boolean isFlag = enumerator.isFlag();
String name = enumerator.name();
Class> foundClass = null;
Class> enumeratorClass = null;
Class> flagsClass = null;
Class> exactDeclaringType = exactType(metaObjectPointer);
if(exactDeclaringType!=null) {
for(Class> cls : exactDeclaringType.getDeclaredClasses()) {
if(QtAbstractEnumerator.class.isAssignableFrom(cls)
|| QFlags.class.isAssignableFrom(cls)) {
if(cls.getSimpleName().equals(name)) {
foundClass = cls;
break;
}
}
}
if(foundClass!=null) {
if(isFlag) {
if(QtAbstractEnumerator.class.isAssignableFrom(foundClass)) {
enumeratorClass = foundClass;
flagsClass = getFlagFromEnum(exactDeclaringType, foundClass);
}else{
flagsClass = foundClass;
enumeratorClass = getEnumFromFlag(foundClass);
}
}else {
if(QtAbstractEnumerator.class.isAssignableFrom(foundClass)) {
flagsClass = getFlagFromEnum(exactDeclaringType, foundClass);
enumeratorClass = foundClass;
}else{
flagsClass = foundClass;
enumeratorClass = getEnumFromFlag(foundClass);
}
}
}
}
if(isFlag && flagsClass==null){
if(enumeratorClass==null) {
QMetaEnum enmType = findEnumForFlags(metaObjectPointer, enumeratorIndex(enumerator));
if(enmType!=null) {
enumeratorClass = enmType.type();
}
}
if(enumeratorClass==null) {
enumeratorClass = QtEnumerator.class;
}
flagsClass = flagsWrapperClass;
}else if(!isFlag && enumeratorClass==null){
enumeratorClass = QtEnumerator.class;
generateEnumEntries(enumerator);
}
if(isFlag) {
generateEnumEntries(enumerator);
}
enumClasses[enumeratorIndex(enumerator)] = isFlag ? flagsClass : enumeratorClass;
}
return enumClasses[enumeratorIndex(enumerator)];
}
@QtUninvokable
private void generateEnumEntries(QMetaEnum enumerator) {
if(enumEntries==null)
enumEntries = new HashMap<>();
ClassLoader cl = type().getClassLoader();
Class>[] ifc = new Class[] {QtEnumerator.class};
QtEnumerator[] entries = new QtEnumerator[enumerator.keyCount()];
for (int i = 0; i < entries.length; i++) {
entries[i] = (QtEnumerator)Proxy.newProxyInstance(cl, ifc, new Enumerator(i, enumerator.key(i), enumerator.value(i)));
}
enumEntries.put(enumeratorIndex(enumerator), new EnumEntries(entries));
}
@QtUninvokable
QtAbstractEnumerator[] enumEntries(QMetaEnum enumerator) {
QtAbstractEnumerator[] entries;
Class> type = enumerator.type();
if(type.isEnum()) {
entries = (QtAbstractEnumerator[])type.getEnumConstants();
}else if(enumEntries!=null){
EnumEntries ee = enumEntries.get(enumeratorIndex(enumerator));
if(ee==null) {
entries = new QtAbstractEnumerator[0];
}else{
entries = Arrays.copyOf(ee.entries, ee.entries.length);
}
}else {
entries = new QtAbstractEnumerator[0];
}
return entries;
}
@QtUninvokable
QtAbstractEnumerator enumEntry(QMetaEnum enumerator, int index) {
Class> type = enumerator.type();
if(type.isEnum()) {
return (QtAbstractEnumerator)type.getEnumConstants()[index];
}else if(enumEntries!=null){
EnumEntries ee = enumEntries.get(enumeratorIndex(enumerator));
if(ee==null) {
return null;
}else{
return ee.entries[index];
}
}else {
return null;
}
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@QtUninvokable
QtAbstractEnumerator enumEntry(QMetaEnum enumerator, String name) {
Class> type = enumerator.type();
if(type.isEnum()) {
return (QtAbstractEnumerator)Enum.valueOf((Class)type, name);
}else if(enumEntries!=null){
EnumEntries ee = enumEntries.get(enumeratorIndex(enumerator));
if(ee==null) {
return null;
}else{
return ee.enumConstantDirectory().get(name);
}
}else {
return null;
}
}
private static class Enumerator implements InvocationHandler{
private Enumerator(int ordinal, String name, int value) {
super();
this.ordinal = ordinal;
this.name = name;
this.value = value;
}
private final int ordinal;
private final String name;
private final int value;
@Override
@QtUninvokable
public Object invoke(Object proxy, Method method, Object[] args) {
switch(method.getName()) {
case "ordinal": return ordinal;
case "value": return value;
case "toString":
case "name": return name;
case "getDeclaringClass": return QtEnumerator.class;
}
return null;
}
}
@QtUninvokable
private static native QMetaEnum findEnumForFlags(long metaObjectPointer, int enumeratorIndex);
@QtUninvokable
private static Class> getFlagFromEnum(Class> exactDeclaringType, Class> type) {
for(Class> flagsType : exactDeclaringType.getDeclaredClasses()) {
if(QFlags.class.isAssignableFrom(flagsType)
&& flagsType.getGenericSuperclass() instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType)flagsType.getGenericSuperclass();
Type[] typeArguments = pt.getActualTypeArguments();
if(typeArguments.length==1 && typeArguments[0] instanceof Class) {
if(typeArguments[0]==type) {
return flagsType;
}
}
}
}
return null;
}
@QtUninvokable
private static Class> getEnumFromFlag(Class> type) {
if(type.getGenericSuperclass() instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType)type.getGenericSuperclass();
Type[] typeArguments = pt.getActualTypeArguments();
if(typeArguments.length==1 && typeArguments[0] instanceof Class) {
if(typeArguments[0]==type) {
return (Class>)typeArguments[0];
}
}
}
return null;
}
/**
* Represents a handle to a signal-slot (or signal-functor) connection.
*
* It can be used to check if the connection is valid and to disconnect it using {@link QObject#disconnect(Connection)}.
* For a signal-functor connection without a context object, it is the only way to selectively disconnect that connection.
*
* As Connection is just a handle, the underlying signal-slot connection is unaffected when Connection is destroyed or reassigned.
*/
public static interface Connection{
/**
* Returns true if the connection is valid.
*/
public boolean isConnected();
/**
* Provides the sender of the connected signal.
* @return sender
*/
public QtSignalEmitterInterface sender();
/**
* Provides the receiver of the signal-slot connection.
* @return receiver
*/
public Object receiver();
}
/**
* Enum representing meta calls.
*/
@SuppressWarnings("unused")
public enum Call implements QtEnumerator{
InvokeMetaMethod(0),
ReadProperty(1),
WriteProperty(2),
ResetProperty(3),
CreateInstance(QtJambi_LibraryUtilities.qtMajorVersion>5 ? 9 : 4),
IndexOfMethod(QtJambi_LibraryUtilities.qtMajorVersion>5 ? 10 : 5),
RegisterPropertyMetaType(QtJambi_LibraryUtilities.qtMajorVersion>5 ? 11 : 6),
RegisterMethodArgumentMetaType(QtJambi_LibraryUtilities.qtMajorVersion>5 ? 12 : 7);
private Call(int value) { this.value = value; }
private final int value;
public static Call resolve(int value) {
switch (value) {
case 0: return InvokeMetaMethod;
case 1: return ReadProperty;
case 2: return WriteProperty;
case 3: return ResetProperty;
case 4:
if(QtJambi_LibraryUtilities.qtMajorVersion>5)
return CreateInstance;
else return QtJambi_LibraryUtilities.internal.resolveEnum(Call.class, value, "QueryPropertyDesignable");
case 5:
if(QtJambi_LibraryUtilities.qtMajorVersion>5)
return IndexOfMethod;
else return QtJambi_LibraryUtilities.internal.resolveEnum(Call.class, value, "QueryPropertyScriptable");
case 6:
if(QtJambi_LibraryUtilities.qtMajorVersion>5)
return RegisterPropertyMetaType;
else return QtJambi_LibraryUtilities.internal.resolveEnum(Call.class, value, "QueryPropertyStored");
case 7:
if(QtJambi_LibraryUtilities.qtMajorVersion>5)
return RegisterMethodArgumentMetaType;
else return QtJambi_LibraryUtilities.internal.resolveEnum(Call.class, value, "QueryPropertyEditable");
case 8:
if(QtJambi_LibraryUtilities.qtMajorVersion>5)
return QtJambi_LibraryUtilities.internal.resolveEnum(Call.class, value, "RegisterQPropertyObserver");
else return QtJambi_LibraryUtilities.internal.resolveEnum(Call.class, value, "QueryPropertyUser");
case 9:
if(QtJambi_LibraryUtilities.qtMajorVersion>5)
return QtJambi_LibraryUtilities.internal.resolveEnum(Call.class, value, "SetQPropertyBinding");
else return CreateInstance;
case 10:
if(QtJambi_LibraryUtilities.qtMajorVersion>5)
throw new io.qt.QNoSuchEnumValueException(value);
else return IndexOfMethod;
case 11:
if(QtJambi_LibraryUtilities.qtMajorVersion>5)
throw new io.qt.QNoSuchEnumValueException(value);
else return RegisterPropertyMetaType;
case 12:
if(QtJambi_LibraryUtilities.qtMajorVersion>5)
throw new io.qt.QNoSuchEnumValueException(value);
else return RegisterMethodArgumentMetaType;
default: throw new io.qt.QNoSuchEnumValueException(value);
}
}
@Override
public int value() {
return value;
}
}
@QtUninvokable
public QMetaProperty userProperty() {
return userProperty(this.metaObjectPointer);
}
@QtUninvokable
private native QMetaProperty userProperty(long metaObjectPointer);
@QtUninvokable
public QList properties() {
return properties(this.metaObjectPointer);
}
@QtUninvokable
private native QList properties(long metaObjectPointer);
@QtUninvokable
public int propertyCount() {
return propertyCount(metaObjectPointer);
}
@QtUninvokable
private static native int propertyCount(long metaObjectPointer);
@QtUninvokable
public QMetaProperty property(String name) {
return property(this.metaObjectPointer, name);
}
@QtUninvokable
private native QMetaProperty property(long metaObjectPointer, String name);
@QtUninvokable
public QMetaProperty property(int index) {
return propertyByIndex(this.metaObjectPointer, index);
}
@QtUninvokable
private native QMetaProperty propertyByIndex(long metaObjectPointer, int index);
@QtUninvokable
public QList enumerators() {
return enumerators(this.metaObjectPointer);
}
@QtUninvokable
private static native QList enumerators(long metaObjectPointer);
@QtUninvokable
public int enumeratorCount() {
return enumeratorCount(metaObjectPointer);
}
@QtUninvokable
private static native int enumeratorCount(long metaObjectPointer);
@QtUninvokable
public io.qt.core.QMetaEnum enumerator(String name) {
return enumerator(this.metaObjectPointer, name);
}
@QtUninvokable
private static native QMetaEnum enumerator(long metaObjectPointer, String name);
@QtUninvokable
public io.qt.core.QMetaEnum enumerator(int index) {
return enumeratorByIndex(this.metaObjectPointer, index);
}
@QtUninvokable
private static native QMetaEnum enumeratorByIndex(long metaObjectPointer, int index);
@QtUninvokable
public static void connectSlotsByName(QObject object) {
connectSlotsByName(QtJambi_LibraryUtilities.internal.checkedNativeId(object));
}
@QtUninvokable
private static native void connectSlotsByName(long object);
@QtUninvokable
static native QMetaObject.@NonNull Connection connect(QObject sender, String signal, QObject receiver, String slot, byte connection);
@QtUninvokable
static native QMetaObject.Connection connectMethods(QObject sender, int signalIdx, long signalEnclosingMetaObject, QObject receiver, int slotIdx, long EnclosingMetaObject, byte connection);
@QtUninvokable
static native boolean disconnect(QObject sender, String signal, QObject receiver, String slot);
@QtUninvokable
static native boolean disconnectMethods(QObject sender, int signalIdx, long signalEnclosingMetaObject, QObject receiver, int slotIdx, long EnclosingMetaObject);
static String internalNameOfType(Class extends Object> cls) {
return internalNameOfArgumentType(cls);
}
@QtUninvokable
public final QMetaMethod method(int methodIndex) {
return methodByIndex(metaObjectPointer, methodIndex);
}
@QtUninvokable
private native QMetaMethod methodByIndex(long metaObjectPointer, int index);
@QtUninvokable
public QMetaMethod method(String name, Class>... parameterTypes) {
if(name==null)
return null;
QMetaMethod method;
int idx = name.indexOf('(');
if(parameterTypes.length==0 && idx>0) {
int spacePos = name.substring(0, idx).trim().lastIndexOf(' ');
if (idx > spacePos && spacePos > 0)
throw new RuntimeException(String.format("Do not specify return type in slot signature: '%1$s'", name));
String cppNormalizedSignature = cppNormalizedSignature(name, this.type());
method = method(metaObjectPointer, cppNormalizedSignature);
if(method==null)
method = method(metaObjectPointer, cppNormalizedSignature+"const");
}else {
StringBuilder args = new StringBuilder();
for(int i=0; i methods(){
return methods(metaObjectPointer);
}
@QtUninvokable
private native QList methods(long metaObjectPointer);
@QtUninvokable
public final int methodCount(){
return methodCount(metaObjectPointer);
}
@QtUninvokable
private native int methodCount(long metaObjectPointer);
@QtUninvokable
public QMetaMethod constructor(Class>... parameterTypes) {
StringBuilder args = new StringBuilder();
for(int i=0; i constructors(){
return constructors(metaObjectPointer);
}
@QtUninvokable
private native QList constructors(long metaObjectPointer);
@QtUninvokable
public final int constructorCount(){
return constructorCount(metaObjectPointer);
}
@QtUninvokable
private native int constructorCount(long metaObjectPointer);
@QtUninvokable
public QObject newInstance(Object... args) throws NoSuchMethodException {
if (!inherits(QObject.staticMetaObject)) {
throw new RuntimeException(String.format("Type %1$s does not inherit QObject", className()));
}
if(constructorCount()==0) {
throw new UnsupportedOperationException("No constructors available.");
}
QMetaMethod constr = null;
QList constructors = constructors();
for(QMetaMethod constructor : constructors.clone()) {
List> parameterTypes = constructor.parameterClassTypes();
if(parameterTypes.size()!=args.length) {
constructors.remove(constructor);
}else{
boolean matches = true;
for(int i=0; i parameterType = parameterTypes.get(i);
if(parameterType.isPrimitive()) {
if(args[i]==null) {
matches = false;
break;
}else{
if(parameterType==long.class
&& !(args[i] instanceof Long
|| args[i] instanceof Integer
|| args[i] instanceof Short
|| args[i] instanceof Byte)) {
matches = false;
break;
}else if(parameterType==int.class
&& !(args[i] instanceof Integer
|| args[i] instanceof Short
|| args[i] instanceof Byte)) {
matches = false;
break;
}else if(parameterType==short.class
&& !(args[i] instanceof Short
|| args[i] instanceof Byte)) {
matches = false;
break;
}else if(parameterType==byte.class
&& !(args[i] instanceof Byte)) {
matches = false;
break;
}else if(parameterType==double.class
&& !(args[i] instanceof Double
|| args[i] instanceof Float
|| args[i] instanceof Long
|| args[i] instanceof Integer
|| args[i] instanceof Short
|| args[i] instanceof Byte)) {
matches = false;
break;
}else if(parameterType==float.class
&& !(args[i] instanceof Float
|| args[i] instanceof Integer
|| args[i] instanceof Short
|| args[i] instanceof Byte)) {
matches = false;
break;
}else if(parameterType==boolean.class
&& !(args[i] instanceof Boolean)) {
matches = false;
break;
}else if(parameterType==char.class
&& !(args[i] instanceof Character)) {
matches = false;
break;
}else if(parameterType==void.class) {
matches = false;
break;
}
}
}else if(args[i]!=null && !parameterType.isInstance(args[i])) {
matches = false;
break;
}
}
if(!matches) {
constructors.remove(constructor);
}
}
}
if(!constructors.isEmpty()) {
constr = constructors.get(0);
}
if(constr==null) {
StringBuilder argsStrg = new StringBuilder();
for(int i=0; i> classInfos(){
return classInfos(metaObjectPointer);
}
@QtUninvokable
private static native QList> classInfos(long metaObjectPointer);
@QtUninvokable
public int classInfoCount() {
return classInfoCount(metaObjectPointer);
}
@QtUninvokable
private static native int classInfoCount(long metaObjectPointer);
@QtUninvokable
public String classInfo(String name){
return classInfo(metaObjectPointer, name);
}
@QtUninvokable
private static native String classInfo(long metaObjectPointer, String name);
/**
* Returns true if the class described by this QMetaObject inherits the type described by metaObject; otherwise returns false.
* A type is considered to inherit itself.
* @param metaObject
* @return inherits
*/
@QtUninvokable
public boolean inherits(QMetaObject metaObject){
return metaObject!=null && inherits(metaObjectPointer, metaObject.metaObjectPointer);
}
@QtUninvokable
private static native boolean inherits(long metaObjectPointer, long other);
/**
* Casts an object to the given targetType. Returns null if object is not instance of targetType.
* @param type
* @param targetType
* @param object
* @return the object as targetType or null
*/
@QtUninvokable
public static T cast(Class targetType, QtObjectInterface object) {
io.qt.QtUtilities.initializePackage(targetType);
if(object==null || targetType.isInstance(object)) {
return targetType.cast(object);
}
return targetType.cast(cast(object, targetType));
}
@QtUninvokable
private static native Object cast(QtObjectInterface object, Class> targetType);
@QtUninvokable
public @Nullable Class> type(){
return type(metaObjectPointer);
}
@QtUninvokable
private static native Class> type(long metaObjectPointer);
@QtUninvokable
public static native @Nullable QMetaObject forType(@Nullable Class> clazz);
@QtUninvokable
private static native Class> exactType(long metaObjectPointer);
@QtUninvokable
public static boolean checkConnectArgs(String signal, String method) {
return checkConnectArgsString(SignalPrefix+cppNormalizedSignature(signal, null), SlotPrefix+cppNormalizedSignature(method, null));
}
@QtUninvokable
private native static boolean checkConnectArgsString(String signal, String method);
@QtUninvokable
public static boolean checkConnectArgs(QMetaMethod signal, QMetaMethod method){
return checkConnectArgsMethods(signal.enclosingMetaObject().metaObjectPointer, signal.methodIndex(), method.enclosingMetaObject().metaObjectPointer, method.methodIndex());
}
@QtUninvokable
private static native boolean checkConnectArgsMethods(long signalMetaObjectPointer, int signalMethodIndex, long methodMetaObjectPointer, int methodMethodIndex);
/**
* Calling invokeMethod(obj, AutoConnection, args)
.
* @param obj object
* @param member method name
* @param args arguments
* @return method result value if any - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
* @throws QNoSuchMethodException if method not available
*/
@QtUninvokable
public static Object invokeMethod(QObject obj, String member, Object... args) throws QUnsuccessfulInvocationException, QNoSuchMethodException {
return invokeMethod(obj, member, Qt.ConnectionType.AutoConnection, args);
}
/**
* Invokes the given method on the given object and returns it's result value.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
* If the invocation is asynchronous, the return value cannot be evaluated.
*
* @param obj object
* @param member method name
* @param args arguments
* @return method result value if any - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
* @throws QNoSuchMethodException if method not available
*/
@QtUninvokable
public static Object invokeMethod(QObject obj, String member, Qt.@NonNull ConnectionType type, Object... args) throws QUnsuccessfulInvocationException, QNoSuchMethodException {
Class>[] parameterTypes;
if(member.contains("(")) {
parameterTypes = new Class>[0];
}else {
parameterTypes = new Class>[args.length];
for (int i = 0; i < parameterTypes.length; i++) {
if(args[i]==null) {
parameterTypes[i] = Object.class;
}else {
if(args[i].getClass().isSynthetic()) {
if(args[i].getClass().getInterfaces().length>1) {
parameterTypes[i] = args[i].getClass().getInterfaces()[0];
}else {
parameterTypes[i] = args[i].getClass().getSuperclass();
}
}else {
parameterTypes[i] = args[i].getClass();
}
}
}
}
QMetaMethod method = obj.metaObject().method(member, parameterTypes);
if(method==null || !method.isValid()) {
throw new QNoSuchMethodException(member);
}
return method.invoke(obj, type, args);
}
/**
* Calling invokeMethod(method, AutoConnection)
.
*
* @param The return type of the method.
* @param method invoked method
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method0 method) throws QUnsuccessfulInvocationException {
return invokeMethod(method, Qt.ConnectionType.AutoConnection);
}
/**
* Invokes the method and returns it's result value.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
* If the invocation is asynchronous, the return value cannot be evaluated.
*
* @param The return type of the method.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@SuppressWarnings("unchecked")
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method0 method, Qt.@NonNull ConnectionType type) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
if(info!=null && info.qobject!=null && !info.qobject.isDisposed() && info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()) {
if(info.lambdaArgs.isEmpty()) {
return (R)qmethod.invoke(info.qobject, type);
}else {
Object[] args = info.lambdaArgs.toArray();
return (R)qmethod.invoke(info.qobject, type, args);
}
}
}
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return null;
}
QThread thread;
switch(type) {
case AutoConnection:
if(method instanceof QtThreadAffineInterface)
thread = ((QtThreadAffineInterface) method).thread();
else
thread = QObject.getQPropertyThread(info);
if(thread!=null && thread!=QThread.currentThread()) {
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections (auto connection with different threads).");
}
case DirectConnection:
try {
return method.invoke();
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(method instanceof QtThreadAffineInterface)
thread = ((QtThreadAffineInterface) method).thread();
else
thread = QObject.getQPropertyThread(info);
if(thread!=null && thread!=QThread.currentThread()) {
AtomicReference result = new AtomicReference<>();
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
result.set(method.invoke());
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return result.get();
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections.");
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
*
* @param The type of the first parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method1 method, A arg1) throws QUnsuccessfulInvocationException {
return invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1);
}
/**
* Invokes the method and returns it's result value.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
* If the invocation is asynchronous, the return value cannot be evaluated.
*
* @param The type of the first parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@SuppressWarnings("unchecked")
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method1 method, Qt.@NonNull ConnectionType type, A arg1) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
if(info!=null && info.qobject!=null && !info.qobject.isDisposed() && info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+1) {
if(info.lambdaArgs.isEmpty()) {
return (R)qmethod.invoke(info.qobject, type, arg1);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 1, info.lambdaArgs.size());
return (R)qmethod.invoke(info.qobject, type, args);
}
}
}
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return null;
}
QThread thread;
switch(type) {
case AutoConnection:
if(method instanceof QtThreadAffineInterface)
thread = ((QtThreadAffineInterface) method).thread();
else
thread = QObject.getQPropertyThread(info);
if(thread!=null && thread!=QThread.currentThread()) {
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections (auto connection with different threads).");
}
case DirectConnection:
try {
return method.invoke(arg1);
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(method instanceof QtThreadAffineInterface)
thread = ((QtThreadAffineInterface) method).thread();
else
thread = QObject.getQPropertyThread(info);
if(thread!=null && thread!=QThread.currentThread()) {
AtomicReference result = new AtomicReference<>();
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
result.set(method.invoke(arg1));
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return result.get();
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections.");
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
*
* @param The type of the first parameter of the method.
* @param The type of the second parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method2 method, A arg1, B arg2) throws QUnsuccessfulInvocationException {
return invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1, arg2);
}
/**
* Invokes the method and returns it's result value.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
* If the invocation is asynchronous, the return value cannot be evaluated.
*
* @param The type of the first parameter of the method.
* @param The type of the second parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@SuppressWarnings("unchecked")
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method2 method, Qt.@NonNull ConnectionType type, A arg1, B arg2) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
if(info!=null && info.qobject!=null && !info.qobject.isDisposed() && info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+2) {
if(info.lambdaArgs.isEmpty()) {
return (R)qmethod.invoke(info.qobject, type, arg1, arg2);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
args[1] = arg2;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 2, info.lambdaArgs.size());
return (R)qmethod.invoke(info.qobject, type, args);
}
}
}
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return null;
}
switch(type) {
case AutoConnection:
if(method instanceof QtThreadAffineInterface) {
QThread thread = ((QtThreadAffineInterface) method).thread();
if(thread!=null && thread!=QThread.currentThread()) {
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections (auto connection with different threads).");
}
}
case DirectConnection:
try {
return method.invoke(arg1, arg2);
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(method instanceof QtThreadAffineInterface) {
QThread thread = ((QtThreadAffineInterface) method).thread();
if(thread!=null && thread!=QThread.currentThread()) {
AtomicReference result = new AtomicReference<>();
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
result.set(method.invoke(arg1, arg2));
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return result.get();
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections.");
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
*
* @param The type of the first parameter of the method.
* @param The type of the second parameter of the method.
* @param The type of the third parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method3 method, A arg1, B arg2, C arg3) throws QUnsuccessfulInvocationException {
return invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1, arg2, arg3);
}
/**
* Invokes the method and returns it's result value.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
* If the invocation is asynchronous, the return value cannot be evaluated.
*
* @param The type of the first parameter of the method.
* @param The type of the second parameter of the method.
* @param The type of the third parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@SuppressWarnings("unchecked")
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method3 method, Qt.@NonNull ConnectionType type, A arg1, B arg2, C arg3) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
if(info!=null && info.qobject!=null && !info.qobject.isDisposed() && info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+3) {
if(info.lambdaArgs.isEmpty()) {
return (R)qmethod.invoke(info.qobject, type, arg1, arg2, arg3);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
args[1] = arg2;
args[2] = arg3;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 3, info.lambdaArgs.size());
return (R)qmethod.invoke(info.qobject, type, args);
}
}
}
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return null;
}
switch(type) {
case AutoConnection:
if(method instanceof QtThreadAffineInterface) {
QThread thread = ((QtThreadAffineInterface) method).thread();
if(thread!=null && thread!=QThread.currentThread()) {
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections (auto connection with different threads).");
}
}
case DirectConnection:
try {
return method.invoke(arg1, arg2, arg3);
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(method instanceof QtThreadAffineInterface) {
QThread thread = ((QtThreadAffineInterface) method).thread();
if(thread!=null && thread!=QThread.currentThread()) {
AtomicReference result = new AtomicReference<>();
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
result.set(method.invoke(arg1, arg2, arg3));
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return result.get();
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections.");
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
*
* @param The type of the first parameter of the method.
* @param The type of the second parameter of the method.
* @param The type of the third parameter of the method.
* @param The type of the fourth parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method4 method, A arg1, B arg2, C arg3, D arg4) throws QUnsuccessfulInvocationException {
return invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1, arg2, arg3, arg4);
}
/**
* Invokes the method and returns it's result value.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
* If the invocation is asynchronous, the return value cannot be evaluated.
*
* @param The type of the first parameter of the method.
* @param The type of the second parameter of the method.
* @param The type of the third parameter of the method.
* @param The type of the fourth parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@SuppressWarnings("unchecked")
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method4 method, Qt.@NonNull ConnectionType type, A arg1, B arg2, C arg3, D arg4) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
if(info!=null && info.qobject!=null && !info.qobject.isDisposed() && info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+4) {
if(info.lambdaArgs.isEmpty()) {
return (R)qmethod.invoke(info.qobject, type, arg1, arg2, arg3, arg4);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
args[1] = arg2;
args[2] = arg3;
args[3] = arg4;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 4, info.lambdaArgs.size());
return (R)qmethod.invoke(info.qobject, type, args);
}
}
}
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return null;
}
switch(type) {
case AutoConnection:
if(method instanceof QtThreadAffineInterface) {
QThread thread = ((QtThreadAffineInterface) method).thread();
if(thread!=null && thread!=QThread.currentThread()) {
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections (auto connection with different threads).");
}
}
case DirectConnection:
try {
return method.invoke(arg1, arg2, arg3, arg4);
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(method instanceof QtThreadAffineInterface) {
QThread thread = ((QtThreadAffineInterface) method).thread();
if(thread!=null && thread!=QThread.currentThread()) {
AtomicReference result = new AtomicReference<>();
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
result.set(method.invoke(arg1, arg2, arg3, arg4));
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return result.get();
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections.");
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
*
* @param The type of the first parameter of the method.
* @param The type of the second parameter of the method.
* @param The type of the third parameter of the method.
* @param The type of the fourth parameter of the method.
* @param The type of the fifth parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method5 method, A arg1, B arg2, C arg3, D arg4, E arg5) throws QUnsuccessfulInvocationException {
return invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1, arg2, arg3, arg4, arg5);
}
/**
* Invokes the method and returns it's result value.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
* If the invocation is asynchronous, the return value cannot be evaluated.
*
* @param The type of the first parameter of the method.
* @param The type of the second parameter of the method.
* @param The type of the third parameter of the method.
* @param The type of the fourth parameter of the method.
* @param The type of the fifth parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@SuppressWarnings("unchecked")
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method5 method, Qt.@NonNull ConnectionType type, A arg1, B arg2, C arg3, D arg4, E arg5) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
if(info!=null && info.qobject!=null && !info.qobject.isDisposed() && info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+5) {
if(info.lambdaArgs.isEmpty()) {
return (R)qmethod.invoke(info.qobject, type, arg1, arg2, arg3, arg4, arg5);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
args[1] = arg2;
args[2] = arg3;
args[3] = arg4;
args[4] = arg5;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 5, info.lambdaArgs.size());
return (R)qmethod.invoke(info.qobject, type, args);
}
}
if(qmethod!=null) {
return (R)qmethod.invoke(info.qobject, type, arg1, arg2, arg3, arg4, arg5);
}
}
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return null;
}
switch(type) {
case AutoConnection:
if(method instanceof QtThreadAffineInterface) {
QThread thread = ((QtThreadAffineInterface) method).thread();
if(thread!=null && thread!=QThread.currentThread()) {
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections (auto connection with different threads).");
}
}
case DirectConnection:
try {
return method.invoke(arg1, arg2, arg3, arg4, arg5);
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(method instanceof QtThreadAffineInterface) {
QThread thread = ((QtThreadAffineInterface) method).thread();
if(thread!=null && thread!=QThread.currentThread()) {
AtomicReference result = new AtomicReference<>();
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
result.set(method.invoke(arg1, arg2, arg3, arg4, arg5));
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return result.get();
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections.");
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
*
* @param The type of the first parameter of the method.
* @param The type of the second parameter of the method.
* @param The type of the third parameter of the method.
* @param The type of the fourth parameter of the method.
* @param The type of the fifth parameter of the method.
* @param The type of the sixth parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @param arg6 Argument for the sixth parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method6 method, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6) throws QUnsuccessfulInvocationException {
return invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1, arg2, arg3, arg4, arg5, arg6);
}
/**
* Invokes the method and returns it's result value.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
* If the invocation is asynchronous, the return value cannot be evaluated.
*
* @param The type of the first parameter of the method.
* @param The type of the second parameter of the method.
* @param The type of the third parameter of the method.
* @param The type of the fourth parameter of the method.
* @param The type of the fifth parameter of the method.
* @param The type of the sixth parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @param arg6 Argument for the sixth parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@SuppressWarnings("unchecked")
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method6 method, Qt.@NonNull ConnectionType type, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
if(info!=null && info.qobject!=null && !info.qobject.isDisposed() && info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+6) {
if(info.lambdaArgs.isEmpty()) {
return (R)qmethod.invoke(info.qobject, type, arg1, arg2, arg3, arg4, arg5, arg6);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
args[1] = arg2;
args[2] = arg3;
args[3] = arg4;
args[4] = arg5;
args[5] = arg6;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 6, info.lambdaArgs.size());
return (R)qmethod.invoke(info.qobject, type, args);
}
}
}
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return null;
}
switch(type) {
case AutoConnection:
if(method instanceof QtThreadAffineInterface) {
QThread thread = ((QtThreadAffineInterface) method).thread();
if(thread!=null && thread!=QThread.currentThread()) {
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections (auto connection with different threads).");
}
}
case DirectConnection:
try {
return method.invoke(arg1, arg2, arg3, arg4, arg5, arg6);
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(method instanceof QtThreadAffineInterface) {
QThread thread = ((QtThreadAffineInterface) method).thread();
if(thread!=null && thread!=QThread.currentThread()) {
AtomicReference result = new AtomicReference<>();
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
result.set(method.invoke(arg1, arg2, arg3, arg4, arg5, arg6));
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return result.get();
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections.");
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
*
* @param The type of the first parameter of the method.
* @param The type of the second parameter of the method.
* @param The type of the third parameter of the method.
* @param The type of the fourth parameter of the method.
* @param The type of the fifth parameter of the method.
* @param The type of the sixth parameter of the method.
* @param The type of the seventh parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @param arg6 Argument for the sixth parameter.
* @param arg7 Argument for the seventh parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method7 method, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6, G arg7) throws QUnsuccessfulInvocationException {
return invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
}
/**
* Invokes the method and returns it's result value.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
* If the invocation is asynchronous, the return value cannot be evaluated.
*
* @param The type of the first parameter of the method.
* @param The type of the second parameter of the method.
* @param The type of the third parameter of the method.
* @param The type of the fourth parameter of the method.
* @param The type of the fifth parameter of the method.
* @param The type of the sixth parameter of the method.
* @param The type of the seventh parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @param arg6 Argument for the sixth parameter.
* @param arg7 Argument for the seventh parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@SuppressWarnings("unchecked")
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method7 method, Qt.@NonNull ConnectionType type, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6, G arg7) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
if(info!=null && info.qobject!=null && !info.qobject.isDisposed() && info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+7) {
if(info.lambdaArgs.isEmpty()) {
return (R)qmethod.invoke(info.qobject, type, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
args[1] = arg2;
args[2] = arg3;
args[3] = arg4;
args[4] = arg5;
args[5] = arg6;
args[6] = arg7;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 7, info.lambdaArgs.size());
return (R)qmethod.invoke(info.qobject, type, args);
}
}
}
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return null;
}
switch(type) {
case AutoConnection:
if(method instanceof QtThreadAffineInterface) {
QThread thread = ((QtThreadAffineInterface) method).thread();
if(thread!=null && thread!=QThread.currentThread()) {
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections (auto connection with different threads).");
}
}
case DirectConnection:
try {
return method.invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(method instanceof QtThreadAffineInterface) {
QThread thread = ((QtThreadAffineInterface) method).thread();
if(thread!=null && thread!=QThread.currentThread()) {
AtomicReference result = new AtomicReference<>();
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
result.set(method.invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7));
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return result.get();
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections.");
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
*
* @param The type of the first parameter of the method.
* @param The type of the second parameter of the method.
* @param The type of the third parameter of the method.
* @param The type of the fourth parameter of the method.
* @param The type of the fifth parameter of the method.
* @param The type of the sixth parameter of the method.
* @param The type of the seventh parameter of the method.
* @param The type of the eighth parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @param arg6 Argument for the sixth parameter.
* @param arg7 Argument for the seventh parameter.
* @param arg8 Argument for the eighth parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method8 method, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6, G arg7, H arg8) throws QUnsuccessfulInvocationException {
return invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
}
/**
* Invokes the method and returns it's result value.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
* If the invocation is asynchronous, the return value cannot be evaluated.
*
* @param The type of the first parameter of the method.
* @param The type of the second parameter of the method.
* @param The type of the third parameter of the method.
* @param The type of the fourth parameter of the method.
* @param The type of the fifth parameter of the method.
* @param The type of the sixth parameter of the method.
* @param The type of the seventh parameter of the method.
* @param The type of the eighth parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @param arg6 Argument for the sixth parameter.
* @param arg7 Argument for the seventh parameter.
* @param arg8 Argument for the eighth parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@SuppressWarnings("unchecked")
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method8 method, Qt.@NonNull ConnectionType type, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6, G arg7, H arg8) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
if(info!=null && info.qobject!=null && !info.qobject.isDisposed() && info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+8) {
if(info.lambdaArgs.isEmpty()) {
return (R)qmethod.invoke(info.qobject, type, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
args[1] = arg2;
args[2] = arg3;
args[3] = arg4;
args[4] = arg5;
args[5] = arg6;
args[6] = arg7;
args[7] = arg8;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 8, info.lambdaArgs.size());
return (R)qmethod.invoke(info.qobject, type, args);
}
}
}
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return null;
}
switch(type) {
case AutoConnection:
if(method instanceof QtThreadAffineInterface) {
QThread thread = ((QtThreadAffineInterface) method).thread();
if(thread!=null && thread!=QThread.currentThread()) {
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections (auto connection with different threads).");
}
}
case DirectConnection:
try {
return method.invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(method instanceof QtThreadAffineInterface) {
QThread thread = ((QtThreadAffineInterface) method).thread();
if(thread!=null && thread!=QThread.currentThread()) {
AtomicReference result = new AtomicReference<>();
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
result.set(method.invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8));
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return result.get();
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections.");
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
*
* @param The type of the first parameter of the method.
* @param The type of the second parameter of the method.
* @param The type of the third parameter of the method.
* @param The type of the fourth parameter of the method.
* @param The type of the fifth parameter of the method.
* @param The type of the sixth parameter of the method.
* @param The type of the seventh parameter of the method.
* @param The type of the eighth parameter of the method.
* @param The type of the ninth parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @param arg6 Argument for the sixth parameter.
* @param arg7 Argument for the seventh parameter.
* @param arg8 Argument for the eighth parameter.
* @param arg9 Argument for the ninth parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method9 method, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6, G arg7, H arg8, I arg9) throws QUnsuccessfulInvocationException {
return invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
}
/**
* Invokes the method and returns it's result value.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
* If the invocation is asynchronous, the return value cannot be evaluated.
*
* @param The type of the first parameter of the method.
* @param The type of the second parameter of the method.
* @param The type of the third parameter of the method.
* @param The type of the fourth parameter of the method.
* @param The type of the fifth parameter of the method.
* @param The type of the sixth parameter of the method.
* @param The type of the seventh parameter of the method.
* @param The type of the eighth parameter of the method.
* @param The type of the ninth parameter of the method.
* @param The return type of the method.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @param arg6 Argument for the sixth parameter.
* @param arg7 Argument for the seventh parameter.
* @param arg8 Argument for the eighth parameter.
* @param arg9 Argument for the ninth parameter.
* @return method result value - if the invocation is asynchronous, the return value cannot be evaluated.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@SuppressWarnings("unchecked")
@QtUninvokable
public static R invokeMethod(@StrictNonNull Method9 method, Qt.@NonNull ConnectionType type, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6, G arg7, H arg8, I arg9) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
if(info!=null && info.qobject!=null && !info.qobject.isDisposed() && info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+9) {
if(info.lambdaArgs.isEmpty()) {
return (R)qmethod.invoke(info.qobject, type, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
args[1] = arg2;
args[2] = arg3;
args[3] = arg4;
args[4] = arg5;
args[5] = arg6;
args[6] = arg7;
args[7] = arg8;
args[8] = arg9;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 9, info.lambdaArgs.size());
return (R)qmethod.invoke(info.qobject, type, args);
}
}
}
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return null;
}
switch(type) {
case AutoConnection:
if(method instanceof QtThreadAffineInterface) {
QThread thread = ((QtThreadAffineInterface) method).thread();
if(thread!=null && thread!=QThread.currentThread()) {
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections (auto connection with different threads).");
}
}
case DirectConnection:
try {
return method.invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(method instanceof QtThreadAffineInterface) {
QThread thread = ((QtThreadAffineInterface) method).thread();
if(thread!=null && thread!=QThread.currentThread()) {
AtomicReference result = new AtomicReference<>();
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
result.set(method.invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9));
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return result.get();
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
throw new QUnsuccessfulInvocationException("Unable to invoke methods with return values in queued connections.");
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection)
.
* @param method invoked method
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot0 method) throws QUnsuccessfulInvocationException {
invokeMethod(method, Qt.ConnectionType.AutoConnection);
}
/**
* Invokes the slot.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
*
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot0 method, Qt.@NonNull ConnectionType type) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
QThread thread = null;
if(info!=null && info.qobject!=null && !info.qobject.isDisposed()) {
if(info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()) {
qmethod.invoke(info.qobject, type, info.lambdaArgs.toArray());
return;
}
}
thread = info.qobject.thread();
}else {
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return;
}
if(method instanceof QtThreadAffineInterface)
thread = ((QtThreadAffineInterface) method).thread();
else
thread = QObject.getQPropertyThread(info);
}
if(type==Qt.ConnectionType.AutoConnection && thread!=null && thread!=QThread.currentThread()) {
type = Qt.ConnectionType.QueuedConnection;
}
switch(type) {
case AutoConnection:
case DirectConnection:
try {
method.invoke();
return;
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(thread!=null) {
if(thread!=QThread.currentThread()) {
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke();
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return;
}else {
throw new QUnsuccessfulInvocationException("Blocking-queued invocation on object whose thread is the current thread is not allowed.");
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke();
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
}
return super.event(event);
}
};
QtJambi_LibraryUtilities.internal.setCppOwnership(invoker);
if(thread!=null)
invoker.moveToThread(thread);
invoker.disposeLater();
return;
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
* @param The type of the first parameter of the slot.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot1 method, A arg1) throws QUnsuccessfulInvocationException {
invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1);
}
/**
* Invokes the slot.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
*
* @param The type of the first parameter of the slot.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot1 method, Qt.@NonNull ConnectionType type, A arg1) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
QThread thread = null;
if(info!=null && info.qobject!=null && !info.qobject.isDisposed()) {
if(info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+1) {
if(info.lambdaArgs.isEmpty()) {
qmethod.invoke(info.qobject, type, arg1);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 1, info.lambdaArgs.size());
qmethod.invoke(info.qobject, type, args);
}
return;
}
}
thread = info.qobject.thread();
}else {
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return;
}
if(method instanceof QtThreadAffineInterface)
thread = ((QtThreadAffineInterface) method).thread();
else
thread = QObject.getQPropertyThread(info);
}
if(type==Qt.ConnectionType.AutoConnection && thread!=null && thread!=QThread.currentThread()) {
type = Qt.ConnectionType.QueuedConnection;
}
switch(type) {
case AutoConnection:
case DirectConnection:
try {
method.invoke(arg1);
return;
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(thread!=null) {
if(thread!=QThread.currentThread()) {
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return;
}else {
throw new QUnsuccessfulInvocationException("Blocking-queued invocation on object whose thread is the current thread is not allowed.");
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
}
return super.event(event);
}
};
QtJambi_LibraryUtilities.internal.setCppOwnership(invoker);
if(thread!=null)
invoker.moveToThread(thread);
invoker.disposeLater();
return;
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
* @param The type of the first parameter of the slot.
* @param The type of the second parameter of the slot.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot2 method, A arg1, B arg2) throws QUnsuccessfulInvocationException {
invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1, arg2);
}
/**
* Invokes the slot.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
*
* @param The type of the first parameter of the slot.
* @param The type of the second parameter of the slot.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot2 method, Qt.@NonNull ConnectionType type, A arg1, B arg2) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
QThread thread = null;
if(info!=null && info.qobject!=null && !info.qobject.isDisposed()) {
if(info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+2) {
if(info.lambdaArgs.isEmpty()) {
qmethod.invoke(info.qobject, type, arg1, arg2);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
args[1] = arg2;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 2, info.lambdaArgs.size());
qmethod.invoke(info.qobject, type, args);
}
return;
}
if(qmethod!=null) {
qmethod.invoke(info.qobject, type, arg1, arg2);
return;
}
}
thread = info.qobject.thread();
}else {
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return;
}
if(method instanceof QtThreadAffineInterface)
thread = ((QtThreadAffineInterface) method).thread();
else
thread = QObject.getQPropertyThread(info);
}
if(type==Qt.ConnectionType.AutoConnection && thread!=null && thread!=QThread.currentThread()) {
type = Qt.ConnectionType.QueuedConnection;
}
switch(type) {
case AutoConnection:
case DirectConnection:
try {
method.invoke(arg1, arg2);
return;
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(thread!=null) {
if(thread!=QThread.currentThread()) {
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1, arg2);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return;
}else {
throw new QUnsuccessfulInvocationException("Blocking-queued invocation on object whose thread is the current thread is not allowed.");
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1, arg2);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
}
return super.event(event);
}
};
QtJambi_LibraryUtilities.internal.setCppOwnership(invoker);
if(thread!=null)
invoker.moveToThread(thread);
invoker.disposeLater();
return;
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
* @param The type of the first parameter of the slot.
* @param The type of the second parameter of the slot.
* @param The type of the third parameter of the slot.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot3 method, A arg1, B arg2, C arg3) throws QUnsuccessfulInvocationException {
invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1, arg2, arg3);
}
/**
* Invokes the slot.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
*
* @param The type of the first parameter of the slot.
* @param The type of the second parameter of the slot.
* @param The type of the third parameter of the slot.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot3 method, Qt.@NonNull ConnectionType type, A arg1, B arg2, C arg3) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
QThread thread = null;
if(info!=null && info.qobject!=null) {
if(info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+3) {
if(info.lambdaArgs.isEmpty()) {
qmethod.invoke(info.qobject, type, arg1, arg2, arg3);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
args[1] = arg2;
args[2] = arg3;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 3, info.lambdaArgs.size());
qmethod.invoke(info.qobject, type, args);
}
return;
}
}
thread = info.qobject.thread();
}else {
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return;
}
if(method instanceof QtThreadAffineInterface)
thread = ((QtThreadAffineInterface) method).thread();
}
if(type==Qt.ConnectionType.AutoConnection && thread!=null && thread!=QThread.currentThread()) {
type = Qt.ConnectionType.QueuedConnection;
}
switch(type) {
case AutoConnection:
case DirectConnection:
try {
method.invoke(arg1, arg2, arg3);
return;
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(thread!=null) {
if(thread!=QThread.currentThread()) {
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1, arg2, arg3);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return;
}else {
throw new QUnsuccessfulInvocationException("Blocking-queued invocation on object whose thread is the current thread is not allowed.");
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1, arg2, arg3);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
}
return super.event(event);
}
};
QtJambi_LibraryUtilities.internal.setCppOwnership(invoker);
if(thread!=null)
invoker.moveToThread(thread);
invoker.disposeLater();
return;
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
* @param The type of the first parameter of the slot.
* @param The type of the second parameter of the slot.
* @param The type of the third parameter of the slot.
* @param The type of the fourth parameter of the slot.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot4 method, A arg1, B arg2, C arg3, D arg4) throws QUnsuccessfulInvocationException {
invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1, arg2, arg3, arg4);
}
/**
* Invokes the slot.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
*
* @param The type of the first parameter of the slot.
* @param The type of the second parameter of the slot.
* @param The type of the third parameter of the slot.
* @param The type of the fourth parameter of the slot.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot4 method, Qt.@NonNull ConnectionType type, A arg1, B arg2, C arg3, D arg4) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
QThread thread = null;
if(info!=null && info.qobject!=null) {
if(info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+4) {
if(info.lambdaArgs.isEmpty()) {
qmethod.invoke(info.qobject, type, arg1, arg2, arg3, arg4);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
args[1] = arg2;
args[2] = arg3;
args[3] = arg4;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 4, info.lambdaArgs.size());
qmethod.invoke(info.qobject, type, args);
}
return;
}
}
thread = info.qobject.thread();
}else {
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return;
}
if(method instanceof QtThreadAffineInterface)
thread = ((QtThreadAffineInterface) method).thread();
}
if(type==Qt.ConnectionType.AutoConnection && thread!=null && thread!=QThread.currentThread()) {
type = Qt.ConnectionType.QueuedConnection;
}
switch(type) {
case AutoConnection:
case DirectConnection:
try {
method.invoke(arg1, arg2, arg3, arg4);
return;
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(thread!=null) {
if(thread!=QThread.currentThread()) {
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1, arg2, arg3, arg4);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return;
}else {
throw new QUnsuccessfulInvocationException("Blocking-queued invocation on object whose thread is the current thread is not allowed.");
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1, arg2, arg3, arg4);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
}
return super.event(event);
}
};
QtJambi_LibraryUtilities.internal.setCppOwnership(invoker);
if(thread!=null)
invoker.moveToThread(thread);
invoker.disposeLater();
return;
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
* @param The type of the first parameter of the slot.
* @param The type of the second parameter of the slot.
* @param The type of the third parameter of the slot.
* @param The type of the fourth parameter of the slot.
* @param The type of the fifth parameter of the slot.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot5 method, A arg1, B arg2, C arg3, D arg4, E arg5) throws QUnsuccessfulInvocationException {
invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1, arg2, arg3, arg4, arg5);
}
/**
* Invokes the slot.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
*
* @param The type of the first parameter of the slot.
* @param The type of the second parameter of the slot.
* @param The type of the third parameter of the slot.
* @param The type of the fourth parameter of the slot.
* @param The type of the fifth parameter of the slot.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot5 method, Qt.@NonNull ConnectionType type, A arg1, B arg2, C arg3, D arg4, E arg5) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
QThread thread = null;
if(info!=null && info.qobject!=null) {
if(info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+5) {
if(info.lambdaArgs.isEmpty()) {
qmethod.invoke(info.qobject, type, arg1, arg2, arg3, arg4, arg5);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
args[1] = arg2;
args[2] = arg3;
args[3] = arg4;
args[4] = arg5;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 5, info.lambdaArgs.size());
qmethod.invoke(info.qobject, type, args);
}
return;
}
}
thread = info.qobject.thread();
}else {
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return;
}
if(method instanceof QtThreadAffineInterface)
thread = ((QtThreadAffineInterface) method).thread();
}
if(type==Qt.ConnectionType.AutoConnection && thread!=null && thread!=QThread.currentThread()) {
type = Qt.ConnectionType.QueuedConnection;
}
switch(type) {
case AutoConnection:
case DirectConnection:
try {
method.invoke(arg1, arg2, arg3, arg4, arg5);
return;
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(thread!=null) {
if(thread!=QThread.currentThread()) {
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1, arg2, arg3, arg4, arg5);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return;
}else {
throw new QUnsuccessfulInvocationException("Blocking-queued invocation on object whose thread is the current thread is not allowed.");
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1, arg2, arg3, arg4, arg5);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
}
return super.event(event);
}
};
QtJambi_LibraryUtilities.internal.setCppOwnership(invoker);
if(thread!=null)
invoker.moveToThread(thread);
invoker.disposeLater();
return;
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
* @param The type of the first parameter of the slot.
* @param The type of the second parameter of the slot.
* @param The type of the third parameter of the slot.
* @param The type of the fourth parameter of the slot.
* @param The type of the fifth parameter of the slot.
* @param The type of the sixth parameter of the slot.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @param arg6 Argument for the sixth parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
public static void invokeMethod(@StrictNonNull Slot6 method, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6) throws QUnsuccessfulInvocationException {
invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1, arg2, arg3, arg4, arg5, arg6);
}
/**
* Invokes the slot.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
*
* @param The type of the first parameter of the slot.
* @param The type of the second parameter of the slot.
* @param The type of the third parameter of the slot.
* @param The type of the fourth parameter of the slot.
* @param The type of the fifth parameter of the slot.
* @param The type of the sixth parameter of the slot.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @param arg6 Argument for the sixth parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot6 method, Qt.@NonNull ConnectionType type, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
QThread thread = null;
if(info!=null && info.qobject!=null) {
if(info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+6) {
if(info.lambdaArgs.isEmpty()) {
qmethod.invoke(info.qobject, type, arg1, arg2, arg3, arg4, arg5, arg6);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
args[1] = arg2;
args[2] = arg3;
args[3] = arg4;
args[4] = arg5;
args[5] = arg6;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 6, info.lambdaArgs.size());
qmethod.invoke(info.qobject, type, args);
}
return;
}
}
thread = info.qobject.thread();
}else {
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return;
}
if(method instanceof QtThreadAffineInterface)
thread = ((QtThreadAffineInterface) method).thread();
}
if(type==Qt.ConnectionType.AutoConnection && thread!=null && thread!=QThread.currentThread()) {
type = Qt.ConnectionType.QueuedConnection;
}
switch(type) {
case AutoConnection:
case DirectConnection:
try {
method.invoke(arg1, arg2, arg3, arg4, arg5, arg6);
return;
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(thread!=null) {
if(thread!=QThread.currentThread()) {
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1, arg2, arg3, arg4, arg5, arg6);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return;
}else {
throw new QUnsuccessfulInvocationException("Blocking-queued invocation on object whose thread is the current thread is not allowed.");
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1, arg2, arg3, arg4, arg5, arg6);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
}
return super.event(event);
}
};
QtJambi_LibraryUtilities.internal.setCppOwnership(invoker);
if(thread!=null)
invoker.moveToThread(thread);
invoker.disposeLater();
return;
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
* @param The type of the first parameter of the slot.
* @param The type of the second parameter of the slot.
* @param The type of the third parameter of the slot.
* @param The type of the fourth parameter of the slot.
* @param The type of the fifth parameter of the slot.
* @param The type of the sixth parameter of the slot.
* @param The type of the seventh parameter of the slot.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @param arg6 Argument for the sixth parameter.
* @param arg7 Argument for the seventh parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot7 method, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6, G arg7) throws QUnsuccessfulInvocationException {
invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
}
/**
* Invokes the slot.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
*
* @param The type of the first parameter of the slot.
* @param The type of the second parameter of the slot.
* @param The type of the third parameter of the slot.
* @param The type of the fourth parameter of the slot.
* @param The type of the fifth parameter of the slot.
* @param The type of the sixth parameter of the slot.
* @param The type of the seventh parameter of the slot.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @param arg6 Argument for the sixth parameter.
* @param arg7 Argument for the seventh parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot7 method, Qt.@NonNull ConnectionType type, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6, G arg7) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
QThread thread = null;
if(info!=null && info.qobject!=null) {
if(info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+7) {
if(info.lambdaArgs.isEmpty()) {
qmethod.invoke(info.qobject, type, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
args[1] = arg2;
args[2] = arg3;
args[3] = arg4;
args[4] = arg5;
args[5] = arg6;
args[6] = arg7;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 7, info.lambdaArgs.size());
qmethod.invoke(info.qobject, type, args);
}
return;
}
}
thread = info.qobject.thread();
}else {
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return;
}
if(method instanceof QtThreadAffineInterface)
thread = ((QtThreadAffineInterface) method).thread();
}
if(type==Qt.ConnectionType.AutoConnection && thread!=null && thread!=QThread.currentThread()) {
type = Qt.ConnectionType.QueuedConnection;
}
switch(type) {
case AutoConnection:
case DirectConnection:
try {
method.invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
return;
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(thread!=null) {
if(thread!=QThread.currentThread()) {
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return;
}else {
throw new QUnsuccessfulInvocationException("Blocking-queued invocation on object whose thread is the current thread is not allowed.");
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
}
return super.event(event);
}
};
QtJambi_LibraryUtilities.internal.setCppOwnership(invoker);
if(thread!=null)
invoker.moveToThread(thread);
invoker.disposeLater();
return;
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
* @param The type of the first parameter of the slot.
* @param The type of the second parameter of the slot.
* @param The type of the third parameter of the slot.
* @param The type of the fourth parameter of the slot.
* @param The type of the fifth parameter of the slot.
* @param The type of the sixth parameter of the slot.
* @param The type of the seventh parameter of the slot.
* @param The type of the eighth parameter of the slot.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @param arg6 Argument for the sixth parameter.
* @param arg7 Argument for the seventh parameter.
* @param arg8 Argument for the eighth parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot8 method, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6, G arg7, H arg8) throws QUnsuccessfulInvocationException {
invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
}
/**
* Invokes the slot.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
*
* @param The type of the first parameter of the slot.
* @param The type of the second parameter of the slot.
* @param The type of the third parameter of the slot.
* @param The type of the fourth parameter of the slot.
* @param The type of the fifth parameter of the slot.
* @param The type of the sixth parameter of the slot.
* @param The type of the seventh parameter of the slot.
* @param The type of the eighth parameter of the slot.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @param arg6 Argument for the sixth parameter.
* @param arg7 Argument for the seventh parameter.
* @param arg8 Argument for the eighth parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot8 method, Qt.@NonNull ConnectionType type, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6, G arg7, H arg8) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
QThread thread = null;
if(info!=null && info.qobject!=null && !info.qobject.isDisposed()) {
if(info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+8) {
if(info.lambdaArgs.isEmpty()) {
qmethod.invoke(info.qobject, type, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
args[1] = arg2;
args[2] = arg3;
args[3] = arg4;
args[4] = arg5;
args[5] = arg6;
args[6] = arg7;
args[7] = arg8;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 8, info.lambdaArgs.size());
qmethod.invoke(info.qobject, type, args);
}
return;
}
}
thread = info.qobject.thread();
}else {
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return;
}
if(method instanceof QtThreadAffineInterface)
thread = ((QtThreadAffineInterface) method).thread();
}
if(type==Qt.ConnectionType.AutoConnection && thread!=null && thread!=QThread.currentThread()) {
type = Qt.ConnectionType.QueuedConnection;
}
switch(type) {
case AutoConnection:
case DirectConnection:
try {
method.invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
return;
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(thread!=null) {
if(thread!=QThread.currentThread()) {
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return;
}else {
throw new QUnsuccessfulInvocationException("Blocking-queued invocation on object whose thread is the current thread is not allowed.");
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
}
return super.event(event);
}
};
QtJambi_LibraryUtilities.internal.setCppOwnership(invoker);
if(thread!=null)
invoker.moveToThread(thread);
invoker.disposeLater();
return;
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(method, AutoConnection, ...)
.
* @param The type of the first parameter of the slot.
* @param The type of the second parameter of the slot.
* @param The type of the third parameter of the slot.
* @param The type of the fourth parameter of the slot.
* @param The type of the fifth parameter of the slot.
* @param The type of the sixth parameter of the slot.
* @param The type of the seventh parameter of the slot.
* @param The type of the eighth parameter of the slot.
* @param The type of the ninth parameter of the slot.
* @param method invoked method
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @param arg6 Argument for the sixth parameter.
* @param arg7 Argument for the seventh parameter.
* @param arg8 Argument for the eighth parameter.
* @param arg9 Argument for the ninth parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot9 method, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6, G arg7, H arg8, I arg9) throws QUnsuccessfulInvocationException {
invokeMethod(method, Qt.ConnectionType.AutoConnection, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
}
/**
* Invokes the slot.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
*
* @param The type of the first parameter of the slot.
* @param The type of the second parameter of the slot.
* @param The type of the third parameter of the slot.
* @param The type of the fourth parameter of the slot.
* @param The type of the fifth parameter of the slot.
* @param The type of the sixth parameter of the slot.
* @param The type of the seventh parameter of the slot.
* @param The type of the eighth parameter of the slot.
* @param The type of the ninth parameter of the slot.
* @param method invoked method
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @param arg3 Argument for the third parameter.
* @param arg4 Argument for the fourth parameter.
* @param arg5 Argument for the fifth parameter.
* @param arg6 Argument for the sixth parameter.
* @param arg7 Argument for the seventh parameter.
* @param arg8 Argument for the eighth parameter.
* @param arg9 Argument for the ninth parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke slot
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull Slot9 method, Qt.@NonNull ConnectionType type, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6, G arg7, H arg8, I arg9) throws QUnsuccessfulInvocationException {
ClassAnalyzerUtility.LambdaInfo info = ClassAnalyzerUtility.lambdaInfo(method);
QThread thread = null;
if(info!=null && info.qobject!=null && !info.qobject.isDisposed()) {
if(info.reflectiveMethod!=null) {
QMetaMethod qmethod = fromReflectedMethod(info.reflectiveMethod);
if(qmethod!=null && qmethod.isValid() && qmethod.parameterTypes().size()==info.lambdaArgs.size()+9) {
if(info.lambdaArgs.isEmpty()) {
qmethod.invoke(info.qobject, type, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
}else {
Object[] args = new Object[qmethod.parameterTypes().size()];
args[0] = arg1;
args[1] = arg2;
args[2] = arg3;
args[3] = arg4;
args[4] = arg5;
args[5] = arg6;
args[6] = arg7;
args[7] = arg8;
args[8] = arg9;
System.arraycopy(info.lambdaArgs.toArray(), 0, args, 9, info.lambdaArgs.size());
qmethod.invoke(info.qobject, type, args);
}
return;
}
}
thread = info.qobject.thread();
}else {
if(method instanceof QtObjectInterface) {
if( ((QtObjectInterface)method).isDisposed() )
return;
}
if(method instanceof QtThreadAffineInterface)
thread = ((QtThreadAffineInterface) method).thread();
}
if(type==Qt.ConnectionType.AutoConnection && thread!=null && thread!=QThread.currentThread()) {
type = Qt.ConnectionType.QueuedConnection;
}
switch(type) {
case AutoConnection:
case DirectConnection:
try {
method.invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
return;
} catch (Throwable e) {
throw new QUnsuccessfulInvocationException(e);
}
case BlockingQueuedConnection:
if(thread!=null) {
if(thread!=QThread.currentThread()) {
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
synchronized (this) {
notifyAll();
}
}
return super.event(event);
}
};
invoker.moveToThread(thread);
synchronized (invoker) {
invoker.disposeLater();
try {
invoker.wait();
} catch (InterruptedException e) {
throw new QUnsuccessfulInvocationException(e);
}
}
return;
}else {
throw new QUnsuccessfulInvocationException("Blocking-queued invocation on object whose thread is the current thread is not allowed.");
}
}
throw new QUnsuccessfulInvocationException("Blocking-queued invocation of method on not allowed without thread affinity.");
case QueuedConnection:
QObject invoker = new QObject() {
@Override
public boolean event(QEvent event) {
if(event.type()==QEvent.Type.DeferredDispose
&& (info==null || info.qobject==null || !info.qobject.isDisposed())
&& !(method instanceof QtObjectInterface && ((QtObjectInterface)method).isDisposed() )) {
try {
method.invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
} catch (Throwable e) {
Logger.getLogger("io.qt.core").log(Level.SEVERE, "Exception thrown during method invokation.", e);
}
}
return super.event(event);
}
};
QtJambi_LibraryUtilities.internal.setCppOwnership(invoker);
if(thread!=null)
invoker.moveToThread(thread);
invoker.disposeLater();
return;
default:
break;
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(signal, AutoConnection)
.
* @param signal invoked signal
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull AbstractPrivateSignal0 signal) throws QUnsuccessfulInvocationException {
invokeMethod(signal, Qt.ConnectionType.AutoConnection);
}
/**
* Invokes the signal.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
*
* @param signal invoked signal
* @param type synchronous or asynchronous invocation
* @throws QUnsuccessfulInvocationException if not able to invoke signal
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull AbstractPrivateSignal0 signal, Qt.@NonNull ConnectionType type) throws QUnsuccessfulInvocationException {
if(signal.containingObject() instanceof QObject && !((QObject)signal.containingObject()).isDisposed()) {
QObject qobject = (QObject)signal.containingObject();
QMetaMethod qmethod = qobject.metaObject().methodByIndex(qobject.metaObject().metaObjectPointer, signal.methodIndex());
if(qmethod!=null) {
qmethod.invoke(qobject, type);
return;
}
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(signal, AutoConnection, ...)
.
*
* @param The type of the first parameter of the signal.
* @param signal invoked signal
* @param arg1 Argument for the first parameter.
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull AbstractPrivateSignal1 signal, A arg1) throws QUnsuccessfulInvocationException {
invokeMethod(signal, Qt.ConnectionType.AutoConnection, arg1);
}
/**
* Invokes the signal.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
*
* @param The type of the first parameter of the signal.
* @param signal invoked signal
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke signal
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull AbstractPrivateSignal1 signal, Qt.@NonNull ConnectionType type, A arg1) throws QUnsuccessfulInvocationException {
if(signal.containingObject() instanceof QObject && !((QObject)signal.containingObject()).isDisposed()) {
QObject qobject = (QObject)signal.containingObject();
QMetaMethod qmethod = qobject.metaObject().methodByIndex(qobject.metaObject().metaObjectPointer, signal.methodIndex());
if(qmethod!=null) {
qmethod.invoke(qobject, type, arg1);
return;
}
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(signal, AutoConnection, ...)
.
*
* @param The type of the first parameter of the signal.
* @param signal invoked signal
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull AbstractSignal1Default1 signal) throws QUnsuccessfulInvocationException {
invokeMethod(signal, Qt.ConnectionType.AutoConnection);
}
/**
* Invokes the signal.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
*
* @param The type of the first parameter of the signal.
* @param signal invoked signal
* @param type synchronous or asynchronous invocation
* @throws QUnsuccessfulInvocationException if not able to invoke signal
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull AbstractSignal1Default1 signal, Qt.@NonNull ConnectionType type) throws QUnsuccessfulInvocationException {
invokeMethod(signal, type, signal.arg1Default.get());
}
/**
* Calling invokeMethod(signal, AutoConnection, ...)
.
*
* @param The type of the first parameter of the signal.
* @param The type of the second parameter of the signal.
* @param signal invoked signal
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull AbstractPrivateSignal2 signal, A arg1, B arg2) throws QUnsuccessfulInvocationException {
invokeMethod(signal, Qt.ConnectionType.AutoConnection, arg1, arg2);
}
/**
* Invokes the signal.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
* - If type is {@link Qt.ConnectionType#DirectConnection}, the member will be invoked immediately.
* - If type is {@link Qt.ConnectionType#QueuedConnection}, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
* - If type is {@link Qt.ConnectionType#BlockingQueuedConnection}, the method will be invoked in the same way as for {@link Qt.ConnectionType#QueuedConnection}, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
* - If type is {@link Qt.ConnectionType#AutoConnection}, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
*
*
* @param The type of the first parameter of the signal.
* @param The type of the second parameter of the signal.
* @param signal invoked signal
* @param type synchronous or asynchronous invocation
* @param arg1 Argument for the first parameter.
* @param arg2 Argument for the second parameter.
* @throws QUnsuccessfulInvocationException if not able to invoke signal
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull AbstractPrivateSignal2 signal, Qt.@NonNull ConnectionType type, A arg1, B arg2) throws QUnsuccessfulInvocationException {
if(signal.containingObject() instanceof QObject && !((QObject)signal.containingObject()).isDisposed()) {
QObject qobject = (QObject)signal.containingObject();
QMetaMethod qmethod = qobject.metaObject().methodByIndex(qobject.metaObject().metaObjectPointer, signal.methodIndex());
if(qmethod!=null) {
qmethod.invoke(qobject, type, arg1, arg2);
return;
}
}
throw new QUnsuccessfulInvocationException("Unable to invoke method.");
}
/**
* Calling invokeMethod(signal, AutoConnection, ...)
.
*
* @param The type of the first parameter of the signal.
* @param The type of the second parameter of the signal.
* @param signal invoked signal
* @param arg1 Argument for the first parameter.
*/
@QtUninvokable
public static void invokeMethod(@StrictNonNull AbstractSignal2Default1 signal, A arg1) throws QUnsuccessfulInvocationException {
invokeMethod(signal, Qt.ConnectionType.AutoConnection, arg1);
}
/**
* Invokes the signal.
*
* The invocation can be either synchronous or asynchronous, depending on type:
*
*