Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return null for class #1

Open
sajjadintel opened this issue Jan 13, 2019 · 1 comment
Open

return null for class #1

sajjadintel opened this issue Jan 13, 2019 · 1 comment
Labels
good first issue Good for newcomers invalid This doesn't seem right question Further information is requested

Comments

@sajjadintel
Copy link

reactor return null object when i use this code:

public UserModel getUserModel() {
	return reactor.get("UserModel", new UserModel());
}

public void updateUserModel(UserModel value) {
	reactor.put("UserModel", value);
}
@abbasnaqdi
Copy link
Owner

abbasnaqdi commented Jan 13, 2019

Hi, the reactor does not ‍‍fully support non data class (full supported Kotlin data class).
but I'll show you a solution.

Example of class structure code:
static class UserModel implements Serializable {
  static int id;
  static String name;

  int getId() {
      return id;
   }

  void setId(int id) {
      UserModel.id = id;
   }

  String getName() {
      return name;
   }

  void setName(String name) {
      UserModel.name = name;
   }
}
Sample usage:
UserModel userModel = new UserModel();
userModel.setId(1);
userModel.setName("emma");

reactor.put("UserModel", userModel);
reactor.get("UserModel", new UserModel());

@abbasnaqdi abbasnaqdi added invalid This doesn't seem right question Further information is requested labels Jan 13, 2019
@abbasnaqdi abbasnaqdi pinned this issue Jan 13, 2019
@abbasnaqdi abbasnaqdi added the good first issue Good for newcomers label Jan 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers invalid This doesn't seem right question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants