本文整理汇总了Java中com.squareup.moshi.ToJson类的典型用法代码示例。如果您正苦于以下问题:Java ToJson类的具体用法?Java ToJson怎么用?Java ToJson使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ToJson类属于com.squareup.moshi包,在下文中一共展示了ToJson类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toJson
import com.squareup.moshi.ToJson; //导入依赖的package包/类
@ToJson
public List<String> toJson(RealmList<RealmString> intList) {
final List<String> outList = new ArrayList<>();
for (final RealmString s : intList) {
outList.add(s.getValue());
}
return outList;
}
示例2: toJson
import com.squareup.moshi.ToJson; //导入依赖的package包/类
@ToJson
String toJson(GitHubEvent event) {
Buffer buffer = new Buffer();
JsonWriter writer = JsonWriter.of(buffer);
Moshi moshi = ServiceGenerator.moshi;
try {
writer.beginObject()
.name("type").value(event.type().toString())
.name("ud").value(event.id())
.name("created_at").value(new FormattedTimeAdapter().toJson(event.createdAt()))
.name("public").value(event.isPublic() != null ? event.isPublic() : true);
writer.name("org");
User.jsonAdapter(moshi).toJson(writer, event.org());
writer.name("actor");
User.jsonAdapter(moshi).toJson(writer, event.actor());
writer.name("repo");
Repository.jsonAdapter(moshi).toJson(writer, event.repo());
writer.name("payload");
payloadToJson(event.type(), moshi, event.payload(), writer);
writer.endObject();
} catch (IOException e) {
e.printStackTrace();
}
return buffer.toString();
}
示例3: toJson
import com.squareup.moshi.ToJson; //导入依赖的package包/类
@ToJson
EthSyncingResultJson toJson(@FalseToNull EthSyncingResult in) {
EthSyncingResultJson out = new EthSyncingResultJson();
out.currentBlock = in.currentBlock;
out.highestBlock = in.highestBlock;
out.knownStates = in.knownStates;
out.pulledStates = in.pulledStates;
out.startingBlock = in.startingBlock;
return out;
}
示例4: toJson
import com.squareup.moshi.ToJson; //导入依赖的package包/类
@ToJson
public int[] toJson(VideoSize videoSize) throws Exception {
if (videoSize == null) {
throw new NullPointerException("Expected video size not to be null.");
}
return new int[]{videoSize.width, videoSize.height};
}
示例5: eventToJson
import com.squareup.moshi.ToJson; //导入依赖的package包/类
@ToJson EventJson eventToJson(Event event) {
EventJson json = new EventJson();
json.title = event.title;
json.begin_date = event.beginDateAndTime.substring(0, 8);
json.begin_time = event.beginDateAndTime.substring(9, 14);
return json;
}
示例6: write
import com.squareup.moshi.ToJson; //导入依赖的package包/类
@ToJson public void write(JsonWriter jsonWriter, AnInterface anInterface) throws IOException {
jsonWriter.beginObject();
jsonWriter.name("name").value(anInterface.getName());
jsonWriter.endObject();
}
示例7: urlToJson
import com.squareup.moshi.ToJson; //导入依赖的package包/类
@ToJson String urlToJson(HttpUrl httpUrl) {
return httpUrl.toString();
}
示例8: toJson
import com.squareup.moshi.ToJson; //导入依赖的package包/类
@ToJson
String toJson(final BigDecimal bigDecimal) {
return bigDecimal.toString();
}
示例9: toJson
import com.squareup.moshi.ToJson; //导入依赖的package包/类
@ToJson
String toJson(final BigInteger bigInteger) {
return bigInteger.toString();
}
示例10: toJson
import com.squareup.moshi.ToJson; //导入依赖的package包/类
@ToJson
void toJson(JsonWriter jsonWriter, List<Applet> applets) {
throw new UnsupportedOperationException();
}
示例11: toJson
import com.squareup.moshi.ToJson; //导入依赖的package包/类
@ToJson
void toJson(JsonWriter writer, @HexColor int color) throws IOException {
throw new UnsupportedOperationException();
}
示例12: toJson
import com.squareup.moshi.ToJson; //导入依赖的package包/类
@ToJson
void toJson(JsonWriter jsonWriter, Applet applet) {
throw new UnsupportedOperationException();
}
示例13: toJson
import com.squareup.moshi.ToJson; //导入依赖的package包/类
@ToJson
public String toJson(DateTime dateTime) {
return DateHelper.toString(dateTime);
}
示例14: toText
import com.squareup.moshi.ToJson; //导入依赖的package包/类
@ToJson
public String toText(LocalDateTime dateTime) {
return dateTime.format(formatter);
}
示例15: toJson
import com.squareup.moshi.ToJson; //导入依赖的package包/类
@ToJson
public Map toJson(ParseMap parseMap) {
return parseMap.map();
}