E / AndroidRuntime(31431): com.google.firebase.database.DatabaseException:Class com.google.firebase.quickstart.database.models.Video $ Snippet是 错过了没有参数的构造函数
显然,我已经为类Snippet
提供了一个没有参数的构造函数:
package com.google.firebase.quickstart.database.models;
import com.google.firebase.database.Exclude;
import com.google.firebase.database.IgnoreExtraProperties;
import java.util.HashMap;
import java.util.Map;
@IgnoreExtraProperties
public class Video {
public String id;
public String parsedUrl;
public String rawUrl;
public int starCount = 0;
public Snippet snippet;
public Map<String, Boolean> stars = new HashMap<>();
public Video() {
// Default constructor required for calls to DataSnapshot.getValue(Post.class)
}
public Video(String uid, String author, String title, String body) {
this.id = id;
this.parsedUrl = parsedUrl;
this.rawUrl = rawUrl;
}
public class Snippet {
public String categoryId;
public String channelId;
public String channelTitle;
public String defaultAudioLanguage;
public String description;
public String liveBroadcastContent;
public String publishedAt;
public String title;
public String[] tags;
public Snippet snippet;
public Localised localised;
public Thumbnail thumbnail;
public String getCategoryId() {
return categoryId;
}
public String getChannelId() {
return channelId;
}
public String getChannelTitle() {
return channelTitle;
}
public String getDefaultAudioLanguage() {
return defaultAudioLanguage;
}
public String getLiveBroadcastContent() {
return liveBroadcastContent;
}
public String getPublishedAt() {
return publishedAt;
}
public String getTitle() {
return title;
}
public Snippet() {
// Default constructor required for calls to DataSnapshot.getValue(User.class)
}
public Snippet(String categoryId,
String channelId,
String channelTitle,
String defaultAudioLanguage,
String description,
String liveBroadcastContent,
String publishedAt,
String title,
String[] tags) {
this.categoryId = categoryId;
this.channelId = channelId;
this.channelTitle = channelTitle;
this.defaultAudioLanguage = defaultAudioLanguage;
this.description = description;
this.liveBroadcastContent = liveBroadcastContent;
this.publishedAt = publishedAt;
this.title = title;
for (int i = 0; i != tags.length; i++) {
this.tags[i] = tags[i];
}
}
public class Localised {
public String description;
public String title;
public Localised() {
// Default constructor required for calls to DataSnapshot.getValue(User.class)
}
public Localised(String description,
String title) {
this.description = description;
this.title = title;
}
public String getDescription() {
return description;
}
public String getTitle() {
return title;
}
}
public class Thumbnail {
public Maxres maxres;
public Standard standard;
public Thumbnail() {
// Default constructor required for calls to DataSnapshot.getValue(User.class)
}
public Thumbnail(Maxres maxres,
Standard standard) {
this.maxres = maxres;
this.standard = standard;
}
public class Maxres {
public String height;
public String url;
public String width;
public Maxres() {
// Default constructor required for calls to DataSnapshot.getValue(User.class)
}
public Maxres(String height,
String url,
String width) {
this.height = height;
this.url = url;
this.width = width;
}
public String getHeight() {
return height;
}
public String getUrl() {
return url;
}
public String getWidth() {
return width;
}
}
public class Standard {
public String height;
public String url;
public String width;
public Standard() {
// Default constructor required for calls to DataSnapshot.getValue(User.class)
}
public Standard(String height,
String url,
String width) {
this.height = height;
this.url = url;
this.width = width;
}
public String getUrl() {
return url;
}
}
public Maxres getMaxres() {
return maxres;
}
public Standard getStandard() {
return standard;
}
}
public Thumbnail getThumbnail() {
return thumbnail;
}
}
public Snippet getSnippet() {
return snippet;
}
public void setSnippet(Snippet snippet) {
this.snippet = snippet;
}
}