Refactor internal classes
This commit is contained in:
parent
bf35a740d0
commit
69e8e744cf
@ -1,6 +1,6 @@
|
||||
package it.tdlight.common;
|
||||
|
||||
import it.tdlight.jni.NativeLog;
|
||||
import it.tdlight.tdnative.NativeLog;
|
||||
import it.tdlight.jni.TdApi;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
@ -1,4 +1,7 @@
|
||||
package it.tdlight.common;
|
||||
package it.tdlight.common.internal;
|
||||
|
||||
import it.tdlight.common.ReactiveTelegramClient;
|
||||
import it.tdlight.common.TelegramClient;
|
||||
|
||||
public abstract class CommonClientManager {
|
||||
|
@ -1,4 +1,7 @@
|
||||
package it.tdlight.common;
|
||||
package it.tdlight.common.internal;
|
||||
|
||||
import it.tdlight.common.ExceptionHandler;
|
||||
import it.tdlight.common.ResultHandler;
|
||||
|
||||
public class Handler {
|
||||
private final ResultHandler resultHandler;
|
@ -1,5 +1,10 @@
|
||||
package it.tdlight.common;
|
||||
package it.tdlight.common.internal;
|
||||
|
||||
import it.tdlight.common.ClientEventsHandler;
|
||||
import it.tdlight.common.ExceptionHandler;
|
||||
import it.tdlight.common.ResultHandler;
|
||||
import it.tdlight.common.TelegramClient;
|
||||
import it.tdlight.common.UpdatesHandler;
|
||||
import it.tdlight.jni.TdApi;
|
||||
import it.tdlight.jni.TdApi.Error;
|
||||
import it.tdlight.jni.TdApi.Function;
|
@ -1,5 +1,7 @@
|
||||
package it.tdlight.common;
|
||||
package it.tdlight.common.internal;
|
||||
|
||||
import it.tdlight.common.ClientEventsHandler;
|
||||
import it.tdlight.common.Init;
|
||||
import it.tdlight.jni.TdApi;
|
||||
import it.tdlight.jni.TdApi.Object;
|
||||
import java.util.ArrayList;
|
@ -1,5 +1,9 @@
|
||||
package it.tdlight.common;
|
||||
package it.tdlight.common.internal;
|
||||
|
||||
import it.tdlight.common.ClientEventsHandler;
|
||||
import it.tdlight.common.ExceptionHandler;
|
||||
import it.tdlight.common.ReactiveItem;
|
||||
import it.tdlight.common.ReactiveTelegramClient;
|
||||
import it.tdlight.jni.TdApi;
|
||||
import it.tdlight.jni.TdApi.Error;
|
||||
import it.tdlight.jni.TdApi.Function;
|
@ -1,4 +1,7 @@
|
||||
package it.tdlight.common;
|
||||
package it.tdlight.common.internal;
|
||||
|
||||
import it.tdlight.common.ExceptionHandler;
|
||||
import it.tdlight.common.UpdatesHandler;
|
||||
|
||||
public class MultiHandler {
|
||||
private final UpdatesHandler updatesHandler;
|
@ -1,6 +1,6 @@
|
||||
package it.tdlight.common;
|
||||
package it.tdlight.common.internal;
|
||||
|
||||
import it.tdlight.jni.NativeClient;
|
||||
import it.tdlight.tdnative.NativeClient;
|
||||
import it.tdlight.jni.TdApi;
|
||||
import it.tdlight.jni.TdApi.Function;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package it.tdlight.common;
|
||||
package it.tdlight.common.internal;
|
||||
|
||||
import it.tdlight.common.EventsHandler;
|
||||
import it.tdlight.common.utils.IntSwapper;
|
||||
import it.tdlight.jni.TdApi;
|
||||
import it.tdlight.jni.TdApi.Object;
|
@ -25,7 +25,7 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import it.tdlight.jni.ObjectsUtils;
|
||||
import it.tdlight.tdnative.ObjectsUtils;
|
||||
|
||||
/**
|
||||
* The class to load the libraries needed to run Tdlib
|
||||
|
@ -1,12 +0,0 @@
|
||||
package it.tdlight.jni;
|
||||
|
||||
public class NativeClient {
|
||||
|
||||
protected static native int createNativeClient();
|
||||
|
||||
protected static native void nativeClientSend(int nativeClientId, long eventId, TdApi.Function function);
|
||||
|
||||
protected static native int nativeClientReceive(int[] clientIds, long[] eventIds, TdApi.Object[] events, double timeout);
|
||||
|
||||
protected static native TdApi.Object nativeClientExecute(TdApi.Function function);
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package it.tdlight.tdlib;
|
||||
|
||||
import it.tdlight.common.CommonClientManager;
|
||||
import it.tdlight.common.internal.CommonClientManager;
|
||||
import it.tdlight.common.ReactiveTelegramClient;
|
||||
import it.tdlight.common.TelegramClient;
|
||||
|
||||
|
7
src/main/java/it/tdlight/tdlib/DummyClass.java
Normal file
7
src/main/java/it/tdlight/tdlib/DummyClass.java
Normal file
@ -0,0 +1,7 @@
|
||||
package it.tdlight.tdlib;
|
||||
|
||||
/**
|
||||
* This class is used to avoid jigsaw errors about empty exports
|
||||
*/
|
||||
@Deprecated
|
||||
public class DummyClass {}
|
@ -1,6 +1,6 @@
|
||||
package it.tdlight.tdlight;
|
||||
|
||||
import it.tdlight.common.CommonClientManager;
|
||||
import it.tdlight.common.internal.CommonClientManager;
|
||||
import it.tdlight.common.ReactiveTelegramClient;
|
||||
import it.tdlight.common.TelegramClient;
|
||||
|
||||
|
7
src/main/java/it/tdlight/tdlight/DummyClass.java
Normal file
7
src/main/java/it/tdlight/tdlight/DummyClass.java
Normal file
@ -0,0 +1,7 @@
|
||||
package it.tdlight.tdlight;
|
||||
|
||||
/**
|
||||
* This class is used to avoid jigsaw errors about empty exports
|
||||
*/
|
||||
@Deprecated
|
||||
public class DummyClass {}
|
15
src/main/java/it/tdlight/tdnative/NativeClient.java
Normal file
15
src/main/java/it/tdlight/tdnative/NativeClient.java
Normal file
@ -0,0 +1,15 @@
|
||||
package it.tdlight.tdnative;
|
||||
|
||||
import it.tdlight.jni.TdApi.Function;
|
||||
import it.tdlight.jni.TdApi.Object;
|
||||
|
||||
public class NativeClient {
|
||||
|
||||
protected static native int createNativeClient();
|
||||
|
||||
protected static native void nativeClientSend(int nativeClientId, long eventId, Function function);
|
||||
|
||||
protected static native int nativeClientReceive(int[] clientIds, long[] eventIds, Object[] events, double timeout);
|
||||
|
||||
protected static native Object nativeClientExecute(Function function);
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package it.tdlight.jni;
|
||||
package it.tdlight.tdnative;
|
||||
|
||||
import it.tdlight.jni.TdApi.SetLogStream;
|
||||
import it.tdlight.jni.TdApi.SetLogVerbosityLevel;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
@ -15,7 +17,7 @@ public class NativeLog {
|
||||
* Sets file path for writing TDLib internal log. By default TDLib writes logs to the System.err.
|
||||
* Use this method to write the log to a file instead.
|
||||
*
|
||||
* @deprecated As of TDLib 1.4.0 in favor of {@link TdApi.SetLogStream}, to be removed in the future.
|
||||
* @deprecated As of TDLib 1.4.0 in favor of {@link SetLogStream}, to be removed in the future.
|
||||
* @param filePath Path to a file for writing TDLib internal log. Use an empty path to
|
||||
* switch back to logging to the System.err.
|
||||
* @return whether opening the log file succeeded.
|
||||
@ -26,7 +28,7 @@ public class NativeLog {
|
||||
/**
|
||||
* Changes the maximum size of TDLib log file.
|
||||
*
|
||||
* @deprecated As of TDLib 1.4.0 in favor of {@link TdApi.SetLogStream}, to be removed in the future.
|
||||
* @deprecated As of TDLib 1.4.0 in favor of {@link SetLogStream}, to be removed in the future.
|
||||
* @param maxFileSize The maximum size of the file to where the internal TDLib log is written
|
||||
* before the file will be auto-rotated. Must be positive. Defaults to 10 MB.
|
||||
*/
|
||||
@ -36,7 +38,7 @@ public class NativeLog {
|
||||
/**
|
||||
* Changes TDLib log verbosity.
|
||||
*
|
||||
* @deprecated As of TDLib 1.4.0 in favor of {@link TdApi.SetLogVerbosityLevel}, to be removed in the future.
|
||||
* @deprecated As of TDLib 1.4.0 in favor of {@link SetLogVerbosityLevel}, to be removed in the future.
|
||||
* @param verbosityLevel New value of log verbosity level. Must be non-negative.
|
||||
* Value 0 corresponds to fatal errors,
|
||||
* value 1 corresponds to java.util.logging.Level.SEVERE,
|
@ -1,4 +1,4 @@
|
||||
package it.tdlight.jni;
|
||||
package it.tdlight.tdnative;
|
||||
|
||||
public class ObjectsUtils {
|
||||
/**
|
11
src/main/java/module-info.java
Normal file
11
src/main/java/module-info.java
Normal file
@ -0,0 +1,11 @@
|
||||
module tdlight.java {
|
||||
requires tdlight.api;
|
||||
requires org.reactivestreams;
|
||||
requires it.unimi.dsi.fastutil;
|
||||
requires org.slf4j;
|
||||
exports it.tdlight.tdlight;
|
||||
exports it.tdlight.tdlib;
|
||||
exports it.tdlight.common;
|
||||
exports it.tdlight.common.utils;
|
||||
exports it.tdlight.common.internal;
|
||||
}
|
@ -169,7 +169,7 @@
|
||||
<release>11</release>
|
||||
<useIncrementalCompilation>false</useIncrementalCompilation>
|
||||
<excludes>
|
||||
<exclude>it/tdlight/tdlight/**</exclude>
|
||||
<exclude>it/tdlight/tdlight/ClientManager.java</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
@ -169,7 +169,7 @@
|
||||
<release>11</release>
|
||||
<useIncrementalCompilation>false</useIncrementalCompilation>
|
||||
<excludes>
|
||||
<exclude>it/tdlight/tdlib/**</exclude>
|
||||
<exclude>it/tdlight/tdlib/ClientManager.java</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
Loading…
Reference in New Issue
Block a user