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

io.qt.internal.CoreUtility Maven / Gradle / Ivy

There is a newer version: 6.8.0
Show newest version
/****************************************************************************
**
** 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.internal;

import java.lang.invoke.MethodHandle;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.function.Consumer;
import java.util.function.Function;

import io.qt.QtSignalEmitterInterface;
import io.qt.core.QMetaObject;
import io.qt.core.QObject;

/**
 * @hidden
 */
public abstract class CoreUtility {
	protected CoreUtility() {throw new RuntimeException();}
	/**
	 * @hidden
	 */
	protected static abstract class AbstractSignal extends SignalUtility.AbstractSignal {
		protected AbstractSignal(){
			super();
		}
		
		protected AbstractSignal(Consumer argumentTest){
			super(argumentTest);
		}
	    
		protected AbstractSignal(Class declaringClass) {
            super(declaringClass);
        }
		
		protected AbstractSignal(Class declaringClass, boolean isDisposed) {
            super(declaringClass, isDisposed);
        }
        
		protected AbstractSignal(String signalName, Class[] types) {
            super(signalName, types);
        }
    }
    
	/**
	 * @hidden
	 */
    protected static abstract class AbstractMultiSignal extends SignalUtility.AbstractMultiSignal {
    	protected AbstractMultiSignal() {
            super();
        }
    }
    
    protected static void checkConnectionToDisposedSignal(QMetaObject.DisposedSignal signal, Object receiver, boolean slotObject) {
        SignalUtility.checkConnectionToDisposedSignalImpl(signal, receiver, slotObject);
    }
    
    protected static void emitNativeSignal(QObject sender, int methodIndex, long metaObjectId, Object args[]) {
    	SignalUtility.emitNativeSignal(sender, methodIndex, metaObjectId, 0, args);
    }
    
    protected static boolean disconnectAll(QtSignalEmitterInterface sender, Object receiver) {
    	return SignalUtility.disconnectAll(sender, receiver);
    }
    
    protected static boolean disconnectOne(QMetaObject.Connection connection) {
    	return SignalUtility.disconnectOne(connection);
    }
    
    protected static Object invokeInterfaceDefaultMethod(Method method, Object object, Object... args) throws Throwable {
		return ReflectionUtility.methodInvocationHandler.invokeInterfaceDefaultMethod(method, object, args);
	}
    
    protected static MethodHandle getMethodHandle(Method method) throws IllegalAccessException {
    	return ReflectionUtility.getMethodHandle(method);
    }
    
    protected static void addClassPath(String path) {
    	ResourceUtility.addSearchPath(path);
    }
    
    protected static void removeClassPath(String path) {
    	ResourceUtility.removeSearchPath(path);
    }
    
    protected static void addClassPath(URL path) {
    	ResourceUtility.addSearchPath(path);
    }
    
    protected static  Function functionFromMethod(Method method){
    	return ReflectionUtility.functionFromMethod(method);
    }
    
    protected static URL createURL(String url) throws MalformedURLException {
    	return new URL(url);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy