@org.apache.flink.api.common.InvalidProgramException: This type (GenericType 对于java 的对象要求;属性必须是public 的修饰符,必须添加无参数构造方法 public class WorldValueDesc { } 欢迎分享,转载请注明来源:内存溢出 public class WorldValueDesc {
private String word; // 属性设置私有 错误1
private int cnt; // 属性设置私有 错误1
//没有添加无参数构造方法 错误1
public WorldValueDesc(String word, int cnt) {
this.word = word;
this.cnt = cnt;
}
public void setWord(String word) {
this.word = word;
}
public void setCnt(int cnt) {
this.cnt = cnt;
}
public String getWord() {
return word;
}
public int getCnt() {
return cnt;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
WorldValueDesc that = (WorldValueDesc) o;
return cnt == that.cnt &&
Objects.equals(word, that.word);
}
@Override
public int hashCode() {
return Objects.hash(word, cnt);
}
@Override
public String toString() {
return "WorldValueDesc{" +
"word='" + word + ''' +
", cnt=" + cnt +
'}';
}
}
修改以后代码
public String word;
public int cnt;public WorldValueDesc() {
}
public WorldValueDesc(String word, int cnt) {
this.word = word;
this.cnt = cnt;
}
public void setWord(String word) {
this.word = word;
}
public void setCnt(int cnt) {
this.cnt = cnt;
}
public String getWord() {
return word;
}
public int getCnt() {
return cnt;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
WorldValueDesc that = (WorldValueDesc) o;
return cnt == that.cnt &&
Objects.equals(word, that.word);
}
@Override
public int hashCode() {
return Objects.hash(word, cnt);
}
@Override
public String toString() {
return "WorldValueDesc{" +
"word='" + word + ''' +
", cnt=" + cnt +
'}';
}
flink的对象作为数据传输的要求
赞
(0)
打赏
微信扫一扫
支付宝扫一扫
评论列表(0条)