|
|
@ -1,16 +1,23 @@
|
|
|
|
// Autogenerated from Pigeon (v0.1.17), do not edit directly.
|
|
|
|
// Autogenerated from Pigeon (v1.0.1), do not edit directly.
|
|
|
|
// See also: https://pub.dev/packages/pigeon
|
|
|
|
// See also: https://pub.dev/packages/pigeon
|
|
|
|
|
|
|
|
|
|
|
|
package dev.flutter.example.books;
|
|
|
|
package dev.flutter.example.books;
|
|
|
|
|
|
|
|
|
|
|
|
import io.flutter.plugin.common.BasicMessageChannel;
|
|
|
|
import io.flutter.plugin.common.BasicMessageChannel;
|
|
|
|
import io.flutter.plugin.common.BinaryMessenger;
|
|
|
|
import io.flutter.plugin.common.BinaryMessenger;
|
|
|
|
|
|
|
|
import io.flutter.plugin.common.MessageCodec;
|
|
|
|
import io.flutter.plugin.common.StandardMessageCodec;
|
|
|
|
import io.flutter.plugin.common.StandardMessageCodec;
|
|
|
|
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
|
|
|
|
|
import java.nio.ByteBuffer;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
/** Generated class from Pigeon. */
|
|
|
|
/** Generated class from Pigeon. */
|
|
|
|
@SuppressWarnings("unused")
|
|
|
|
@SuppressWarnings(
|
|
|
|
|
|
|
|
{"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"})
|
|
|
|
public class Api {
|
|
|
|
public class Api {
|
|
|
|
|
|
|
|
|
|
|
|
/** Generated class from Pigeon that represents data sent in messages. */
|
|
|
|
/** Generated class from Pigeon that represents data sent in messages. */
|
|
|
@ -33,23 +40,33 @@ public class Api {
|
|
|
|
|
|
|
|
|
|
|
|
private String publishDate;
|
|
|
|
private String publishDate;
|
|
|
|
public String getPublishDate() { return publishDate; }
|
|
|
|
public String getPublishDate() { return publishDate; }
|
|
|
|
public void setPublishDate(String setterArg) { this.publishDate = setterArg; }
|
|
|
|
public void setPublishDate(String setterArg) {
|
|
|
|
|
|
|
|
this.publishDate = setterArg;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Long pageCount;
|
|
|
|
private Long pageCount;
|
|
|
|
public Long getPageCount() { return pageCount; }
|
|
|
|
public Long getPageCount() { return pageCount; }
|
|
|
|
public void setPageCount(Long setterArg) { this.pageCount = setterArg; }
|
|
|
|
public void setPageCount(Long setterArg) { this.pageCount = setterArg; }
|
|
|
|
|
|
|
|
|
|
|
|
HashMap toMap() {
|
|
|
|
private Thumbnail thumbnail;
|
|
|
|
HashMap<String, Object> toMapResult = new HashMap<>();
|
|
|
|
public Thumbnail getThumbnail() { return thumbnail; }
|
|
|
|
|
|
|
|
public void setThumbnail(Thumbnail setterArg) {
|
|
|
|
|
|
|
|
this.thumbnail = setterArg;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> toMap() {
|
|
|
|
|
|
|
|
Map<String, Object> toMapResult = new HashMap<>();
|
|
|
|
toMapResult.put("title", title);
|
|
|
|
toMapResult.put("title", title);
|
|
|
|
toMapResult.put("subtitle", subtitle);
|
|
|
|
toMapResult.put("subtitle", subtitle);
|
|
|
|
toMapResult.put("author", author);
|
|
|
|
toMapResult.put("author", author);
|
|
|
|
toMapResult.put("summary", summary);
|
|
|
|
toMapResult.put("summary", summary);
|
|
|
|
toMapResult.put("publishDate", publishDate);
|
|
|
|
toMapResult.put("publishDate", publishDate);
|
|
|
|
toMapResult.put("pageCount", pageCount);
|
|
|
|
toMapResult.put("pageCount", pageCount);
|
|
|
|
|
|
|
|
toMapResult.put("thumbnail",
|
|
|
|
|
|
|
|
(thumbnail == null) ? null : thumbnail.toMap());
|
|
|
|
return toMapResult;
|
|
|
|
return toMapResult;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static Book fromMap(HashMap map) {
|
|
|
|
static Book fromMap(Map<String, Object> map) {
|
|
|
|
Book fromMapResult = new Book();
|
|
|
|
Book fromMapResult = new Book();
|
|
|
|
Object title = map.get("title");
|
|
|
|
Object title = map.get("title");
|
|
|
|
fromMapResult.title = (String)title;
|
|
|
|
fromMapResult.title = (String)title;
|
|
|
@ -62,12 +79,64 @@ public class Api {
|
|
|
|
Object publishDate = map.get("publishDate");
|
|
|
|
Object publishDate = map.get("publishDate");
|
|
|
|
fromMapResult.publishDate = (String)publishDate;
|
|
|
|
fromMapResult.publishDate = (String)publishDate;
|
|
|
|
Object pageCount = map.get("pageCount");
|
|
|
|
Object pageCount = map.get("pageCount");
|
|
|
|
fromMapResult.pageCount = (pageCount == null) ? null : ((pageCount instanceof Integer) ? (Integer)pageCount : (Long)pageCount);
|
|
|
|
fromMapResult.pageCount =
|
|
|
|
|
|
|
|
(pageCount == null)
|
|
|
|
|
|
|
|
? null
|
|
|
|
|
|
|
|
: ((pageCount instanceof Integer) ? (Integer)pageCount
|
|
|
|
|
|
|
|
: (Long)pageCount);
|
|
|
|
|
|
|
|
Object thumbnail = map.get("thumbnail");
|
|
|
|
|
|
|
|
fromMapResult.thumbnail = Thumbnail.fromMap((Map)thumbnail);
|
|
|
|
return fromMapResult;
|
|
|
|
return fromMapResult;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Generated class from Pigeon that represents Flutter messages that can be called from Java.*/
|
|
|
|
/** Generated class from Pigeon that represents data sent in messages. */
|
|
|
|
|
|
|
|
public static class Thumbnail {
|
|
|
|
|
|
|
|
private String url;
|
|
|
|
|
|
|
|
public String getUrl() { return url; }
|
|
|
|
|
|
|
|
public void setUrl(String setterArg) { this.url = setterArg; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> toMap() {
|
|
|
|
|
|
|
|
Map<String, Object> toMapResult = new HashMap<>();
|
|
|
|
|
|
|
|
toMapResult.put("url", url);
|
|
|
|
|
|
|
|
return toMapResult;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static Thumbnail fromMap(Map<String, Object> map) {
|
|
|
|
|
|
|
|
Thumbnail fromMapResult = new Thumbnail();
|
|
|
|
|
|
|
|
Object url = map.get("url");
|
|
|
|
|
|
|
|
fromMapResult.url = (String)url;
|
|
|
|
|
|
|
|
return fromMapResult;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private static class FlutterBookApiCodec extends StandardMessageCodec {
|
|
|
|
|
|
|
|
public static final FlutterBookApiCodec INSTANCE =
|
|
|
|
|
|
|
|
new FlutterBookApiCodec();
|
|
|
|
|
|
|
|
private FlutterBookApiCodec() {}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected Object readValueOfType(byte type, ByteBuffer buffer) {
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
|
|
|
|
case (byte)128:
|
|
|
|
|
|
|
|
return Book.fromMap((Map<String, Object>)readValue(buffer));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
return super.readValueOfType(type, buffer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void writeValue(ByteArrayOutputStream stream, Object value) {
|
|
|
|
|
|
|
|
if (value instanceof Book) {
|
|
|
|
|
|
|
|
stream.write(128);
|
|
|
|
|
|
|
|
writeValue(stream, ((Book)value).toMap());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
super.writeValue(stream, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Generated class from Pigeon that represents Flutter messages that can be
|
|
|
|
|
|
|
|
* called from Java.
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static class FlutterBookApi {
|
|
|
|
public static class FlutterBookApi {
|
|
|
|
private final BinaryMessenger binaryMessenger;
|
|
|
|
private final BinaryMessenger binaryMessenger;
|
|
|
|
public FlutterBookApi(BinaryMessenger argBinaryMessenger) {
|
|
|
|
public FlutterBookApi(BinaryMessenger argBinaryMessenger) {
|
|
|
@ -76,34 +145,69 @@ public class Api {
|
|
|
|
public interface Reply<T> {
|
|
|
|
public interface Reply<T> {
|
|
|
|
void reply(T reply);
|
|
|
|
void reply(T reply);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void displayBookDetails(Book argInput, Reply<Void> callback) {
|
|
|
|
static MessageCodec<Object> getCodec() {
|
|
|
|
BasicMessageChannel<Object> channel =
|
|
|
|
return FlutterBookApiCodec.INSTANCE;
|
|
|
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterBookApi.displayBookDetails", new StandardMessageCodec());
|
|
|
|
}
|
|
|
|
HashMap inputMap = argInput.toMap();
|
|
|
|
|
|
|
|
channel.send(inputMap, channelReply -> {
|
|
|
|
public void displayBookDetails(Book bookArg, Reply<Void> callback) {
|
|
|
|
callback.reply(null);
|
|
|
|
BasicMessageChannel<Object> channel = new BasicMessageChannel<>(
|
|
|
|
});
|
|
|
|
binaryMessenger,
|
|
|
|
|
|
|
|
"dev.flutter.pigeon.FlutterBookApi.displayBookDetails", getCodec());
|
|
|
|
|
|
|
|
channel.send(new ArrayList<Object>(Arrays.asList(bookArg)),
|
|
|
|
|
|
|
|
channelReply -> { callback.reply(null); });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private static class HostBookApiCodec extends StandardMessageCodec {
|
|
|
|
|
|
|
|
public static final HostBookApiCodec INSTANCE = new HostBookApiCodec();
|
|
|
|
|
|
|
|
private HostBookApiCodec() {}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected Object readValueOfType(byte type, ByteBuffer buffer) {
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
|
|
|
|
case (byte)128:
|
|
|
|
|
|
|
|
return Book.fromMap((Map<String, Object>)readValue(buffer));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
return super.readValueOfType(type, buffer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void writeValue(ByteArrayOutputStream stream, Object value) {
|
|
|
|
|
|
|
|
if (value instanceof Book) {
|
|
|
|
|
|
|
|
stream.write(128);
|
|
|
|
|
|
|
|
writeValue(stream, ((Book)value).toMap());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
super.writeValue(stream, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Generated interface from Pigeon that represents a handler of messages from Flutter.*/
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Generated interface from Pigeon that represents a handler of messages from
|
|
|
|
|
|
|
|
* Flutter.
|
|
|
|
|
|
|
|
*/
|
|
|
|
public interface HostBookApi {
|
|
|
|
public interface HostBookApi {
|
|
|
|
void cancel();
|
|
|
|
void cancel();
|
|
|
|
void finishEditingBook(Book arg);
|
|
|
|
void finishEditingBook(Book book);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** The codec used by HostBookApi. */
|
|
|
|
|
|
|
|
static MessageCodec<Object> getCodec() { return HostBookApiCodec.INSTANCE; }
|
|
|
|
|
|
|
|
|
|
|
|
/** Sets up an instance of `HostBookApi` to handle messages through the `binaryMessenger` */
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Sets up an instance of `HostBookApi` to handle messages through the
|
|
|
|
|
|
|
|
* `binaryMessenger`.
|
|
|
|
|
|
|
|
*/
|
|
|
|
static void setup(BinaryMessenger binaryMessenger, HostBookApi api) {
|
|
|
|
static void setup(BinaryMessenger binaryMessenger, HostBookApi api) {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
BasicMessageChannel<Object> channel =
|
|
|
|
BasicMessageChannel<Object> channel = new BasicMessageChannel<>(
|
|
|
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostBookApi.cancel", new StandardMessageCodec());
|
|
|
|
binaryMessenger, "dev.flutter.pigeon.HostBookApi.cancel",
|
|
|
|
|
|
|
|
getCodec());
|
|
|
|
if (api != null) {
|
|
|
|
if (api != null) {
|
|
|
|
channel.setMessageHandler((message, reply) -> {
|
|
|
|
channel.setMessageHandler((message, reply) -> {
|
|
|
|
HashMap<String, HashMap> wrapped = new HashMap<>();
|
|
|
|
Map<String, Object> wrapped = new HashMap<>();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
api.cancel();
|
|
|
|
api.cancel();
|
|
|
|
wrapped.put("result", null);
|
|
|
|
wrapped.put("result", null);
|
|
|
|
}
|
|
|
|
} catch (Error | RuntimeException exception) {
|
|
|
|
catch (Exception exception) {
|
|
|
|
|
|
|
|
wrapped.put("error", wrapError(exception));
|
|
|
|
wrapped.put("error", wrapError(exception));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
reply.reply(wrapped);
|
|
|
|
reply.reply(wrapped);
|
|
|
@ -113,18 +217,21 @@ public class Api {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
{
|
|
|
|
{
|
|
|
|
BasicMessageChannel<Object> channel =
|
|
|
|
BasicMessageChannel<Object> channel = new BasicMessageChannel<>(
|
|
|
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostBookApi.finishEditingBook", new StandardMessageCodec());
|
|
|
|
binaryMessenger, "dev.flutter.pigeon.HostBookApi.finishEditingBook",
|
|
|
|
|
|
|
|
getCodec());
|
|
|
|
if (api != null) {
|
|
|
|
if (api != null) {
|
|
|
|
channel.setMessageHandler((message, reply) -> {
|
|
|
|
channel.setMessageHandler((message, reply) -> {
|
|
|
|
HashMap<String, HashMap> wrapped = new HashMap<>();
|
|
|
|
Map<String, Object> wrapped = new HashMap<>();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
@SuppressWarnings("ConstantConditions")
|
|
|
|
ArrayList<Object> args = (ArrayList<Object>)message;
|
|
|
|
Book input = Book.fromMap((HashMap)message);
|
|
|
|
Book bookArg = (Book)args.get(0);
|
|
|
|
api.finishEditingBook(input);
|
|
|
|
if (bookArg == null) {
|
|
|
|
wrapped.put("result", null);
|
|
|
|
throw new NullPointerException("bookArg unexpectedly null.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception exception) {
|
|
|
|
api.finishEditingBook(bookArg);
|
|
|
|
|
|
|
|
wrapped.put("result", null);
|
|
|
|
|
|
|
|
} catch (Error | RuntimeException exception) {
|
|
|
|
wrapped.put("error", wrapError(exception));
|
|
|
|
wrapped.put("error", wrapError(exception));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
reply.reply(wrapped);
|
|
|
|
reply.reply(wrapped);
|
|
|
@ -135,8 +242,8 @@ public class Api {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private static HashMap wrapError(Exception exception) {
|
|
|
|
private static Map<String, Object> wrapError(Throwable exception) {
|
|
|
|
HashMap<String, Object> errorMap = new HashMap<>();
|
|
|
|
Map<String, Object> errorMap = new HashMap<>();
|
|
|
|
errorMap.put("message", exception.toString());
|
|
|
|
errorMap.put("message", exception.toString());
|
|
|
|
errorMap.put("code", exception.getClass().getSimpleName());
|
|
|
|
errorMap.put("code", exception.getClass().getSimpleName());
|
|
|
|
errorMap.put("details", null);
|
|
|
|
errorMap.put("details", null);
|
|
|
|