-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pigeon] removed warnings from generated java code (#171)
- Loading branch information
Showing
10 changed files
with
289 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
232 changes: 232 additions & 0 deletions
232
packages/pigeon/e2e_tests/test_objc/android/app/src/main/java/io/flutter/plugins/Pigeon.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,232 @@ | ||
// Autogenerated from Pigeon (v0.1.2), do not edit directly. | ||
// See also: https://pub.dev/packages/pigeon | ||
|
||
package dev.flutter.aaclarke.pigeon; | ||
|
||
import io.flutter.plugin.common.BasicMessageChannel; | ||
import io.flutter.plugin.common.BinaryMessenger; | ||
import io.flutter.plugin.common.StandardMessageCodec; | ||
import java.util.HashMap; | ||
|
||
/** Generated class from Pigeon. */ | ||
@SuppressWarnings("unused") | ||
public class Pigeon { | ||
|
||
/** Generated class from Pigeon that represents data sent in messages. */ | ||
public static class SearchReply { | ||
private String result; | ||
|
||
public String getResult() { | ||
return result; | ||
} | ||
|
||
public void setResult(String setterArg) { | ||
this.result = setterArg; | ||
} | ||
|
||
private String error; | ||
|
||
public String getError() { | ||
return error; | ||
} | ||
|
||
public void setError(String setterArg) { | ||
this.error = setterArg; | ||
} | ||
|
||
HashMap toMap() { | ||
HashMap<String, Object> toMapResult = new HashMap<>(); | ||
toMapResult.put("result", result); | ||
toMapResult.put("error", error); | ||
return toMapResult; | ||
} | ||
|
||
static SearchReply fromMap(HashMap map) { | ||
SearchReply fromMapResult = new SearchReply(); | ||
Object result = map.get("result"); | ||
fromMapResult.result = (String) result; | ||
Object error = map.get("error"); | ||
fromMapResult.error = (String) error; | ||
return fromMapResult; | ||
} | ||
} | ||
|
||
/** Generated class from Pigeon that represents data sent in messages. */ | ||
public static class SearchRequest { | ||
private String query; | ||
|
||
public String getQuery() { | ||
return query; | ||
} | ||
|
||
public void setQuery(String setterArg) { | ||
this.query = setterArg; | ||
} | ||
|
||
private Long anInt; | ||
|
||
public Long getAnInt() { | ||
return anInt; | ||
} | ||
|
||
public void setAnInt(Long setterArg) { | ||
this.anInt = setterArg; | ||
} | ||
|
||
private Boolean aBool; | ||
|
||
public Boolean getABool() { | ||
return aBool; | ||
} | ||
|
||
public void setABool(Boolean setterArg) { | ||
this.aBool = setterArg; | ||
} | ||
|
||
HashMap toMap() { | ||
HashMap<String, Object> toMapResult = new HashMap<>(); | ||
toMapResult.put("query", query); | ||
toMapResult.put("anInt", anInt); | ||
toMapResult.put("aBool", aBool); | ||
return toMapResult; | ||
} | ||
|
||
static SearchRequest fromMap(HashMap map) { | ||
SearchRequest fromMapResult = new SearchRequest(); | ||
Object query = map.get("query"); | ||
fromMapResult.query = (String) query; | ||
Object anInt = map.get("anInt"); | ||
fromMapResult.anInt = | ||
(anInt == null) ? null : ((anInt instanceof Integer) ? (Integer) anInt : (Long) anInt); | ||
Object aBool = map.get("aBool"); | ||
fromMapResult.aBool = (Boolean) aBool; | ||
return fromMapResult; | ||
} | ||
} | ||
|
||
/** Generated class from Pigeon that represents data sent in messages. */ | ||
public static class Nested { | ||
private SearchRequest request; | ||
|
||
public SearchRequest getRequest() { | ||
return request; | ||
} | ||
|
||
public void setRequest(SearchRequest setterArg) { | ||
this.request = setterArg; | ||
} | ||
|
||
HashMap toMap() { | ||
HashMap<String, Object> toMapResult = new HashMap<>(); | ||
toMapResult.put("request", request); | ||
return toMapResult; | ||
} | ||
|
||
static Nested fromMap(HashMap map) { | ||
Nested fromMapResult = new Nested(); | ||
Object request = map.get("request"); | ||
fromMapResult.request = (SearchRequest) request; | ||
return fromMapResult; | ||
} | ||
} | ||
|
||
/** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ | ||
public static class FlutterSearchApi { | ||
private final BinaryMessenger binaryMessenger; | ||
|
||
public FlutterSearchApi(BinaryMessenger argBinaryMessenger) { | ||
this.binaryMessenger = argBinaryMessenger; | ||
} | ||
|
||
public interface Reply<T> { | ||
void reply(T reply); | ||
} | ||
|
||
public void search(SearchRequest argInput, Reply<SearchReply> callback) { | ||
BasicMessageChannel<Object> channel = | ||
new BasicMessageChannel<>( | ||
binaryMessenger, | ||
"dev.flutter.pigeon.FlutterSearchApi.search", | ||
new StandardMessageCodec()); | ||
HashMap inputMap = argInput.toMap(); | ||
channel.send( | ||
inputMap, | ||
channelReply -> { | ||
HashMap outputMap = (HashMap) channelReply; | ||
@SuppressWarnings("ConstantConditions") | ||
SearchReply output = SearchReply.fromMap(outputMap); | ||
callback.reply(output); | ||
}); | ||
} | ||
} | ||
|
||
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */ | ||
public interface NestedApi { | ||
SearchReply search(Nested arg); | ||
|
||
/** Sets up an instance of `NestedApi` to handle messages through the `binaryMessenger` */ | ||
static void setup(BinaryMessenger binaryMessenger, NestedApi api) { | ||
{ | ||
BasicMessageChannel<Object> channel = | ||
new BasicMessageChannel<>( | ||
binaryMessenger, "dev.flutter.pigeon.NestedApi.search", new StandardMessageCodec()); | ||
if (api != null) { | ||
channel.setMessageHandler( | ||
(message, reply) -> { | ||
HashMap<String, HashMap> wrapped = new HashMap<>(); | ||
try { | ||
@SuppressWarnings("ConstantConditions") | ||
Nested input = Nested.fromMap((HashMap) message); | ||
SearchReply output = api.search(input); | ||
wrapped.put("result", output.toMap()); | ||
} catch (Exception exception) { | ||
wrapped.put("error", wrapError(exception)); | ||
} | ||
reply.reply(wrapped); | ||
}); | ||
} else { | ||
channel.setMessageHandler(null); | ||
} | ||
} | ||
} | ||
} | ||
|
||
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */ | ||
public interface Api { | ||
SearchReply search(SearchRequest arg); | ||
|
||
/** Sets up an instance of `Api` to handle messages through the `binaryMessenger` */ | ||
static void setup(BinaryMessenger binaryMessenger, Api api) { | ||
{ | ||
BasicMessageChannel<Object> channel = | ||
new BasicMessageChannel<>( | ||
binaryMessenger, "dev.flutter.pigeon.Api.search", new StandardMessageCodec()); | ||
if (api != null) { | ||
channel.setMessageHandler( | ||
(message, reply) -> { | ||
HashMap<String, HashMap> wrapped = new HashMap<>(); | ||
try { | ||
@SuppressWarnings("ConstantConditions") | ||
SearchRequest input = SearchRequest.fromMap((HashMap) message); | ||
SearchReply output = api.search(input); | ||
wrapped.put("result", output.toMap()); | ||
} catch (Exception exception) { | ||
wrapped.put("error", wrapError(exception)); | ||
} | ||
reply.reply(wrapped); | ||
}); | ||
} else { | ||
channel.setMessageHandler(null); | ||
} | ||
} | ||
} | ||
} | ||
|
||
private static HashMap wrapError(Exception exception) { | ||
HashMap<String, Object> errorMap = new HashMap<>(); | ||
errorMap.put("message", exception.toString()); | ||
errorMap.put("code", null); | ||
errorMap.put("details", null); | ||
return errorMap; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.