Edit: Sorry for my previous question, the final keyword will confusing you, It's not appropriate. And sorry for my poor English too.
-----Question------
Assume I have a model class without any constructor, because I need to initialize it within many different logic. But i have a notnull keyword.
public class Model {
public notnull String name;
public notnull String address;
public notnull int age;
}
And I need to use it in different place but keep checking if all notnull fields were initialized in compile time
Model m = new Model();
m.name = "Hello";
m.age = 15;
// syntax error, you should set Model.address
Or
Model m1 = new Model();
m1.address = "World";
m1.age = 20;
// syntax error, you should set Model.name
How can I achieve that in java? Thx.