When you\'re making a Plain Old Java Object that\'s meant to be serialized from and deserialized to Firebase, is there a way to use the ServerValue.TIMESTAMP va
Same solution, but I use this.
@IgnoreExtraProperties
public class FIRPost {
Object timestamp;
public FIRPost() {
// Default constructor required for calls to DataSnapshot.getValue(FIRPost.class)
this.timestamp = ServerValue.TIMESTAMP;
}
public Object getTimestamp() {
return timestamp;
}
@Exclude
public Long getTimestamp(boolean isLong) {
if (timestamp instanceof Long) return (Long) timestamp;
else return null;
}
}