webpush-java
webpush-java copied to clipboard
How can I pass Subscription.Keys to Subscription constructor if Keys is nested class?
Maybe will be good to move
public class Keys {
public String p256dh;
public String auth;
public Keys() {
}
public Keys(String p256dh, String auth) {
this.p256dh = p256dh;
this.auth = auth;
}
}
to Keys.java class
I can use
OuterClass.InnerClass innerObject = outerObject.new InnerClass();
But I think it's not a good pracites
Thanks for your feedback! I created this as an inner class because I use Gson to deserialize a JSON string to a subscription. If I recall correctly, to deserialize a JSON string with nested objects Gson requires nested classes. I can check if this is still the case and refactor this if possible, but I don't consider this a big issue.
@MartijnDwars In my scenario I'm saving keys in database and need to be manually set values.