|
| 1 | +// Autogenerated from Pigeon (v0.1.2), do not edit directly. |
| 2 | +// See also: https://pub.dev/packages/pigeon |
| 3 | + |
| 4 | +package dev.flutter.aaclarke.pigeon; |
| 5 | + |
| 6 | +import io.flutter.plugin.common.BasicMessageChannel; |
| 7 | +import io.flutter.plugin.common.BinaryMessenger; |
| 8 | +import io.flutter.plugin.common.StandardMessageCodec; |
| 9 | +import java.util.HashMap; |
| 10 | + |
| 11 | +/** Generated class from Pigeon. */ |
| 12 | +@SuppressWarnings("unused") |
| 13 | +public class Pigeon { |
| 14 | + |
| 15 | + /** Generated class from Pigeon that represents data sent in messages. */ |
| 16 | + public static class SearchReply { |
| 17 | + private String result; |
| 18 | + |
| 19 | + public String getResult() { |
| 20 | + return result; |
| 21 | + } |
| 22 | + |
| 23 | + public void setResult(String setterArg) { |
| 24 | + this.result = setterArg; |
| 25 | + } |
| 26 | + |
| 27 | + private String error; |
| 28 | + |
| 29 | + public String getError() { |
| 30 | + return error; |
| 31 | + } |
| 32 | + |
| 33 | + public void setError(String setterArg) { |
| 34 | + this.error = setterArg; |
| 35 | + } |
| 36 | + |
| 37 | + HashMap toMap() { |
| 38 | + HashMap<String, Object> toMapResult = new HashMap<>(); |
| 39 | + toMapResult.put("result", result); |
| 40 | + toMapResult.put("error", error); |
| 41 | + return toMapResult; |
| 42 | + } |
| 43 | + |
| 44 | + static SearchReply fromMap(HashMap map) { |
| 45 | + SearchReply fromMapResult = new SearchReply(); |
| 46 | + Object result = map.get("result"); |
| 47 | + fromMapResult.result = (String) result; |
| 48 | + Object error = map.get("error"); |
| 49 | + fromMapResult.error = (String) error; |
| 50 | + return fromMapResult; |
| 51 | + } |
| 52 | + } |
| 53 | + |
| 54 | + /** Generated class from Pigeon that represents data sent in messages. */ |
| 55 | + public static class SearchRequest { |
| 56 | + private String query; |
| 57 | + |
| 58 | + public String getQuery() { |
| 59 | + return query; |
| 60 | + } |
| 61 | + |
| 62 | + public void setQuery(String setterArg) { |
| 63 | + this.query = setterArg; |
| 64 | + } |
| 65 | + |
| 66 | + private Long anInt; |
| 67 | + |
| 68 | + public Long getAnInt() { |
| 69 | + return anInt; |
| 70 | + } |
| 71 | + |
| 72 | + public void setAnInt(Long setterArg) { |
| 73 | + this.anInt = setterArg; |
| 74 | + } |
| 75 | + |
| 76 | + private Boolean aBool; |
| 77 | + |
| 78 | + public Boolean getABool() { |
| 79 | + return aBool; |
| 80 | + } |
| 81 | + |
| 82 | + public void setABool(Boolean setterArg) { |
| 83 | + this.aBool = setterArg; |
| 84 | + } |
| 85 | + |
| 86 | + HashMap toMap() { |
| 87 | + HashMap<String, Object> toMapResult = new HashMap<>(); |
| 88 | + toMapResult.put("query", query); |
| 89 | + toMapResult.put("anInt", anInt); |
| 90 | + toMapResult.put("aBool", aBool); |
| 91 | + return toMapResult; |
| 92 | + } |
| 93 | + |
| 94 | + static SearchRequest fromMap(HashMap map) { |
| 95 | + SearchRequest fromMapResult = new SearchRequest(); |
| 96 | + Object query = map.get("query"); |
| 97 | + fromMapResult.query = (String) query; |
| 98 | + Object anInt = map.get("anInt"); |
| 99 | + fromMapResult.anInt = |
| 100 | + (anInt == null) ? null : ((anInt instanceof Integer) ? (Integer) anInt : (Long) anInt); |
| 101 | + Object aBool = map.get("aBool"); |
| 102 | + fromMapResult.aBool = (Boolean) aBool; |
| 103 | + return fromMapResult; |
| 104 | + } |
| 105 | + } |
| 106 | + |
| 107 | + /** Generated class from Pigeon that represents data sent in messages. */ |
| 108 | + public static class Nested { |
| 109 | + private SearchRequest request; |
| 110 | + |
| 111 | + public SearchRequest getRequest() { |
| 112 | + return request; |
| 113 | + } |
| 114 | + |
| 115 | + public void setRequest(SearchRequest setterArg) { |
| 116 | + this.request = setterArg; |
| 117 | + } |
| 118 | + |
| 119 | + HashMap toMap() { |
| 120 | + HashMap<String, Object> toMapResult = new HashMap<>(); |
| 121 | + toMapResult.put("request", request); |
| 122 | + return toMapResult; |
| 123 | + } |
| 124 | + |
| 125 | + static Nested fromMap(HashMap map) { |
| 126 | + Nested fromMapResult = new Nested(); |
| 127 | + Object request = map.get("request"); |
| 128 | + fromMapResult.request = (SearchRequest) request; |
| 129 | + return fromMapResult; |
| 130 | + } |
| 131 | + } |
| 132 | + |
| 133 | + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ |
| 134 | + public static class FlutterSearchApi { |
| 135 | + private final BinaryMessenger binaryMessenger; |
| 136 | + |
| 137 | + public FlutterSearchApi(BinaryMessenger argBinaryMessenger) { |
| 138 | + this.binaryMessenger = argBinaryMessenger; |
| 139 | + } |
| 140 | + |
| 141 | + public interface Reply<T> { |
| 142 | + void reply(T reply); |
| 143 | + } |
| 144 | + |
| 145 | + public void search(SearchRequest argInput, Reply<SearchReply> callback) { |
| 146 | + BasicMessageChannel<Object> channel = |
| 147 | + new BasicMessageChannel<>( |
| 148 | + binaryMessenger, |
| 149 | + "dev.flutter.pigeon.FlutterSearchApi.search", |
| 150 | + new StandardMessageCodec()); |
| 151 | + HashMap inputMap = argInput.toMap(); |
| 152 | + channel.send( |
| 153 | + inputMap, |
| 154 | + channelReply -> { |
| 155 | + HashMap outputMap = (HashMap) channelReply; |
| 156 | + @SuppressWarnings("ConstantConditions") |
| 157 | + SearchReply output = SearchReply.fromMap(outputMap); |
| 158 | + callback.reply(output); |
| 159 | + }); |
| 160 | + } |
| 161 | + } |
| 162 | + |
| 163 | + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ |
| 164 | + public interface NestedApi { |
| 165 | + SearchReply search(Nested arg); |
| 166 | + |
| 167 | + /** Sets up an instance of `NestedApi` to handle messages through the `binaryMessenger` */ |
| 168 | + static void setup(BinaryMessenger binaryMessenger, NestedApi api) { |
| 169 | + { |
| 170 | + BasicMessageChannel<Object> channel = |
| 171 | + new BasicMessageChannel<>( |
| 172 | + binaryMessenger, "dev.flutter.pigeon.NestedApi.search", new StandardMessageCodec()); |
| 173 | + if (api != null) { |
| 174 | + channel.setMessageHandler( |
| 175 | + (message, reply) -> { |
| 176 | + HashMap<String, HashMap> wrapped = new HashMap<>(); |
| 177 | + try { |
| 178 | + @SuppressWarnings("ConstantConditions") |
| 179 | + Nested input = Nested.fromMap((HashMap) message); |
| 180 | + SearchReply output = api.search(input); |
| 181 | + wrapped.put("result", output.toMap()); |
| 182 | + } catch (Exception exception) { |
| 183 | + wrapped.put("error", wrapError(exception)); |
| 184 | + } |
| 185 | + reply.reply(wrapped); |
| 186 | + }); |
| 187 | + } else { |
| 188 | + channel.setMessageHandler(null); |
| 189 | + } |
| 190 | + } |
| 191 | + } |
| 192 | + } |
| 193 | + |
| 194 | + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ |
| 195 | + public interface Api { |
| 196 | + SearchReply search(SearchRequest arg); |
| 197 | + |
| 198 | + /** Sets up an instance of `Api` to handle messages through the `binaryMessenger` */ |
| 199 | + static void setup(BinaryMessenger binaryMessenger, Api api) { |
| 200 | + { |
| 201 | + BasicMessageChannel<Object> channel = |
| 202 | + new BasicMessageChannel<>( |
| 203 | + binaryMessenger, "dev.flutter.pigeon.Api.search", new StandardMessageCodec()); |
| 204 | + if (api != null) { |
| 205 | + channel.setMessageHandler( |
| 206 | + (message, reply) -> { |
| 207 | + HashMap<String, HashMap> wrapped = new HashMap<>(); |
| 208 | + try { |
| 209 | + @SuppressWarnings("ConstantConditions") |
| 210 | + SearchRequest input = SearchRequest.fromMap((HashMap) message); |
| 211 | + SearchReply output = api.search(input); |
| 212 | + wrapped.put("result", output.toMap()); |
| 213 | + } catch (Exception exception) { |
| 214 | + wrapped.put("error", wrapError(exception)); |
| 215 | + } |
| 216 | + reply.reply(wrapped); |
| 217 | + }); |
| 218 | + } else { |
| 219 | + channel.setMessageHandler(null); |
| 220 | + } |
| 221 | + } |
| 222 | + } |
| 223 | + } |
| 224 | + |
| 225 | + private static HashMap wrapError(Exception exception) { |
| 226 | + HashMap<String, Object> errorMap = new HashMap<>(); |
| 227 | + errorMap.put("message", exception.toString()); |
| 228 | + errorMap.put("code", null); |
| 229 | + errorMap.put("details", null); |
| 230 | + return errorMap; |
| 231 | + } |
| 232 | +} |
0 commit comments