|
| 1 | +// Copyright 2013 The Flutter Authors. All rights reserved. |
| 2 | +// Use of this source code is governed by a BSD-style license that can be |
| 3 | +// found in the LICENSE file. |
| 4 | +// Autogenerated from Pigeon (v11.0.1), do not edit directly. |
| 5 | +// See also: https://pub.dev/packages/pigeon |
| 6 | + |
| 7 | +package com.baseflow.instancemanager; |
| 8 | + |
| 9 | +import android.util.Log; |
| 10 | +import androidx.annotation.NonNull; |
| 11 | +import androidx.annotation.Nullable; |
| 12 | +import io.flutter.plugin.common.BasicMessageChannel; |
| 13 | +import io.flutter.plugin.common.BinaryMessenger; |
| 14 | +import io.flutter.plugin.common.MessageCodec; |
| 15 | +import io.flutter.plugin.common.StandardMessageCodec; |
| 16 | +import java.io.ByteArrayOutputStream; |
| 17 | +import java.nio.ByteBuffer; |
| 18 | +import java.util.ArrayList; |
| 19 | +import java.util.Arrays; |
| 20 | +import java.util.Collections; |
| 21 | +import java.util.HashMap; |
| 22 | +import java.util.List; |
| 23 | +import java.util.Map; |
| 24 | + |
| 25 | +/** Generated class from Pigeon. */ |
| 26 | +@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"}) |
| 27 | +public class AndroidInstanceManagerPigeon { |
| 28 | + |
| 29 | + /** Error class for passing custom error details to Flutter via a thrown PlatformException. */ |
| 30 | + public static class FlutterError extends RuntimeException { |
| 31 | + |
| 32 | + /** The error code. */ |
| 33 | + public final String code; |
| 34 | + |
| 35 | + /** The error details. Must be a datatype supported by the api codec. */ |
| 36 | + public final Object details; |
| 37 | + |
| 38 | + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) |
| 39 | + { |
| 40 | + super(message); |
| 41 | + this.code = code; |
| 42 | + this.details = details; |
| 43 | + } |
| 44 | + } |
| 45 | + |
| 46 | + @NonNull |
| 47 | + protected static ArrayList<Object> wrapError(@NonNull Throwable exception) { |
| 48 | + ArrayList<Object> errorList = new ArrayList<Object>(3); |
| 49 | + if (exception instanceof FlutterError) { |
| 50 | + FlutterError error = (FlutterError) exception; |
| 51 | + errorList.add(error.code); |
| 52 | + errorList.add(error.getMessage()); |
| 53 | + errorList.add(error.details); |
| 54 | + } else { |
| 55 | + errorList.add(exception.toString()); |
| 56 | + errorList.add(exception.getClass().getSimpleName()); |
| 57 | + errorList.add( |
| 58 | + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); |
| 59 | + } |
| 60 | + return errorList; |
| 61 | + } |
| 62 | + /** |
| 63 | + * Host API for managing the native `InstanceManager`. |
| 64 | + * |
| 65 | + * Generated interface from Pigeon that represents a handler of messages from Flutter. |
| 66 | + */ |
| 67 | + public interface AndroidInstanceManagerHostApi { |
| 68 | + /** |
| 69 | + * Clear the native `InstanceManager`. |
| 70 | + * |
| 71 | + * This is typically only used after a hot restart. |
| 72 | + */ |
| 73 | + void clear(); |
| 74 | + |
| 75 | + /** The codec used by AndroidInstanceManagerHostApi. */ |
| 76 | + static @NonNull MessageCodec<Object> getCodec() { |
| 77 | + return new StandardMessageCodec(); |
| 78 | + } |
| 79 | + /**Sets up an instance of `AndroidInstanceManagerHostApi` to handle messages through the `binaryMessenger`. */ |
| 80 | + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable AndroidInstanceManagerHostApi api) { |
| 81 | + { |
| 82 | + BasicMessageChannel<Object> channel = |
| 83 | + new BasicMessageChannel<>( |
| 84 | + binaryMessenger, "dev.flutter.pigeon.flutter_instance_manager.AndroidInstanceManagerHostApi.clear", getCodec()); |
| 85 | + if (api != null) { |
| 86 | + channel.setMessageHandler( |
| 87 | + (message, reply) -> { |
| 88 | + ArrayList<Object> wrapped = new ArrayList<Object>(); |
| 89 | + try { |
| 90 | + api.clear(); |
| 91 | + wrapped.add(0, null); |
| 92 | + } |
| 93 | + catch (Throwable exception) { |
| 94 | + ArrayList<Object> wrappedError = wrapError(exception); |
| 95 | + wrapped = wrappedError; |
| 96 | + } |
| 97 | + reply.reply(wrapped); |
| 98 | + }); |
| 99 | + } else { |
| 100 | + channel.setMessageHandler(null); |
| 101 | + } |
| 102 | + } |
| 103 | + } |
| 104 | + } |
| 105 | + /** |
| 106 | + * Handles methods calls to the native Java Object class. |
| 107 | + * |
| 108 | + * Also handles calls to remove the reference to an instance with `dispose`. |
| 109 | + * |
| 110 | + * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. |
| 111 | + * |
| 112 | + * Generated interface from Pigeon that represents a handler of messages from Flutter. |
| 113 | + */ |
| 114 | + public interface JavaObjectHostApi { |
| 115 | + |
| 116 | + void dispose(@NonNull String identifier); |
| 117 | + |
| 118 | + /** The codec used by JavaObjectHostApi. */ |
| 119 | + static @NonNull MessageCodec<Object> getCodec() { |
| 120 | + return new StandardMessageCodec(); |
| 121 | + } |
| 122 | + /**Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. */ |
| 123 | + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObjectHostApi api) { |
| 124 | + { |
| 125 | + BasicMessageChannel<Object> channel = |
| 126 | + new BasicMessageChannel<>( |
| 127 | + binaryMessenger, "dev.flutter.pigeon.flutter_instance_manager.JavaObjectHostApi.dispose", getCodec()); |
| 128 | + if (api != null) { |
| 129 | + channel.setMessageHandler( |
| 130 | + (message, reply) -> { |
| 131 | + ArrayList<Object> wrapped = new ArrayList<Object>(); |
| 132 | + ArrayList<Object> args = (ArrayList<Object>) message; |
| 133 | + String identifierArg = (String) args.get(0); |
| 134 | + try { |
| 135 | + api.dispose(identifierArg); |
| 136 | + wrapped.add(0, null); |
| 137 | + } |
| 138 | + catch (Throwable exception) { |
| 139 | + ArrayList<Object> wrappedError = wrapError(exception); |
| 140 | + wrapped = wrappedError; |
| 141 | + } |
| 142 | + reply.reply(wrapped); |
| 143 | + }); |
| 144 | + } else { |
| 145 | + channel.setMessageHandler(null); |
| 146 | + } |
| 147 | + } |
| 148 | + } |
| 149 | + } |
| 150 | + /** |
| 151 | + * Handles callbacks methods for the native Java Object class. |
| 152 | + * |
| 153 | + * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. |
| 154 | + * |
| 155 | + * Generated class from Pigeon that represents Flutter messages that can be called from Java. |
| 156 | + */ |
| 157 | + public static class JavaObjectFlutterApi { |
| 158 | + private final @NonNull BinaryMessenger binaryMessenger; |
| 159 | + |
| 160 | + public JavaObjectFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { |
| 161 | + this.binaryMessenger = argBinaryMessenger; |
| 162 | + } |
| 163 | + |
| 164 | + /** Public interface for sending reply. */ |
| 165 | + @SuppressWarnings("UnknownNullness") |
| 166 | + public interface Reply<T> { |
| 167 | + void reply(T reply); |
| 168 | + } |
| 169 | + /** The codec used by JavaObjectFlutterApi. */ |
| 170 | + static @NonNull MessageCodec<Object> getCodec() { |
| 171 | + return new StandardMessageCodec(); |
| 172 | + } |
| 173 | + public void dispose(@NonNull String identifierArg, @NonNull Reply<Void> callback) { |
| 174 | + BasicMessageChannel<Object> channel = |
| 175 | + new BasicMessageChannel<>( |
| 176 | + binaryMessenger, "dev.flutter.pigeon.flutter_instance_manager.JavaObjectFlutterApi.dispose", getCodec()); |
| 177 | + channel.send( |
| 178 | + new ArrayList<Object>(Collections.singletonList(identifierArg)), |
| 179 | + channelReply -> callback.reply(null)); |
| 180 | + } |
| 181 | + } |
| 182 | +} |
0 commit comments