Reputation: 612
I have a key and value that key is reserved-word in java.
{
class:"1/1"
}
How can I map the datasnapshot with custom class
CustomClass customClass = dataSnapshot.getValue(CustomClass.class);
CustomClass.java
public class CustomClass{
private String class //can not use class or Class
}
Upvotes: 0
Views: 789
Reputation: 280
Try using @PropertyName
, which marks a field to be renamed when serialized.
public class Foo {
@PropertyName("class")
private String clazz;
public String getClazz() {
return clazz;
}
public void setClazz(String clazz) {
this.clazz = clazz;
}
}
Upvotes: 1