我有一个 json 数据,我想创建模型类来访问 LISTING 数组

我想让模型类 pojo 只访问列表数组和视频数组。请帮助我在这个网址上找到我的 api:http://itelc.com/wbs/api/index.php/stream

http://itelc.com/wbs/api/index.php/stream


明月笑刀无情
浏览 98回答 1
1回答

慕姐8265434

这是列表和视频的模型类-----------------------------------com.your.package.name.Listing.java-----------------------------------package com.your.package.name;import java.util.List;public class Listing {&nbsp; &nbsp; private int section;&nbsp; &nbsp; private List<Video> videos = null;&nbsp; &nbsp; public int getSection() {&nbsp; &nbsp; &nbsp; &nbsp; return section;&nbsp; &nbsp; }&nbsp; &nbsp; public void setSection(int section) {&nbsp; &nbsp; &nbsp; &nbsp; this.section = section;&nbsp; &nbsp; }&nbsp; &nbsp; public List<Video> getVideos() {&nbsp; &nbsp; &nbsp; &nbsp; return videos;&nbsp; &nbsp; }&nbsp; &nbsp; public void setVideos(List<Video> videos) {&nbsp; &nbsp; &nbsp; &nbsp; this.videos = videos;&nbsp; &nbsp; }}-----------------------------------com.your.package.name.Video.java-----------------------------------package com.your.package.name;public class Video {&nbsp; &nbsp; private String title;&nbsp; &nbsp; private String videoUrl;&nbsp; &nbsp; private String thumbnail;&nbsp; &nbsp; public String getTitle() {&nbsp; &nbsp; &nbsp; &nbsp; return title;&nbsp; &nbsp; }&nbsp; &nbsp; public void setTitle(String title) {&nbsp; &nbsp; &nbsp; &nbsp; this.title = title;&nbsp; &nbsp; }&nbsp; &nbsp; public String getVideoUrl() {&nbsp; &nbsp; &nbsp; &nbsp; return videoUrl;&nbsp; &nbsp; }&nbsp; &nbsp; public void setVideoUrl(String videoUrl) {&nbsp; &nbsp; &nbsp; &nbsp; this.videoUrl = videoUrl;&nbsp; &nbsp; }&nbsp; &nbsp; public String getThumbnail() {&nbsp; &nbsp; &nbsp; &nbsp; return thumbnail;&nbsp; &nbsp; }&nbsp; &nbsp; public void setThumbnail(String thumbnail) {&nbsp; &nbsp; &nbsp; &nbsp; this.thumbnail = thumbnail;&nbsp; &nbsp; }}
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java