我试图在类中使用一个构造函数来扩展 DBFlow 中的 BaseModel,但我在控制台中得到了这个。
/home/christoandrew/Documents/Trumeter/app/build/generated/source/apt/debug/com/iconasystems/android/trumeter/models/Session_Table.java:144: error: constructor Session in class Session cannot be applied to given types;
return new Session(); ^
required: String,String
found: no arguments
reason: actual and formal argument lists differ in length
这是我的 Session.java
@Table(database = TrumeterDatabase.class)
public class Session extends BaseModel{
@PrimaryKey
@Column
@SerializedName("username")
String username;
@Column
@SerializedName("password")
String password;
public Session(String username, String password) {
this.username = username;
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
现在,当我检查生成的表类时,它在实例化中没有参数。我一直在检查,所有教程似乎都没有在他们的类中包含构造函数。是我的错误还是应该怎么做。