Reputation: 33
I have a huge class with 500 members. Each member will have properties whether it can be Filled/Edited based on business logic .
public class Person{
public String firstName;
//500 more Fields below
}
And similarly other 500 fields .
Consumer of the class will need whether the firstName can be Filled/Edited .
Straight forward way is
Enum FieldProperty{
CanBeEdited,CanBeFilled
}
public class Person{
public String firstName;
List<FieldProperty> firstNameProperties = list(CanBeFilled)
//500 more Fields below
}
How to efficiently represent this ?
Upvotes: 0
Views: 98
Reputation: 33
I am settling with below approach .
public class UiProperties<T>{
Boolean CanBeEdited;
Boolean CanBeFilled;
Boolean CanBeDeleted;
}
public class Person{
public UiProperties<String> firstName;
public UiProperties<String> lastName;
public UiProperties<Date> dob;
//500 more Fields below
}
Upvotes: 0