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

Allow usage of the builder pattern when constructing ClassDefinitions #1

Open
coderbot16 opened this issue Feb 27, 2020 · 0 comments
Open

Comments

@coderbot16
Copy link

Since many users will only want to use a few features of ClassDefinition at a time it would make more sense to allow usage of the builder pattern, even if only as a utility. It's hard to see what each parameter means when there are so many:

MemberHolder holder = entry.getValue();
classDefs.add(new ClassDefinition(name, Collections.emptySet(), holder.fields, holder.methods, new HashSet<>(holder.fields), Collections.emptySet(), Collections.emptySet()));

versus

MemberHolder holder = entry.getValue();
ClassDefinition definition = new ClassDefinition.Builder(name)
	.publicizeFields(holder.fields)
	.publicizeMethods(holder.methods)
	.mutableFields(holder.fields)
	.build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant