feat(java, info): builder design pattern for java-info
Describe the enhancement requested
Naive constructors are not friendly for users when the function need such more parameters
https://github.com/apache/incubator-graphar/blob/09703b6fc3ed3499fc8ed1b410647e50c96ec506/maven-projects/info/src/main/java/org/apache/graphar/info/EdgeInfo.java#L54-L65
The builder design pattern will help.
Component(s)
Java
Hey, could you assign me for this issue?
Hi @Jarvx200, Thank you for your interest in graphar, please refer to CONTRIBUTING.md
Hi @Jarvx200 , the EdgeInfo is just an example, here are all class that need builder:
- GraphInfo
- EdgeInfo
- VertexInfo
- PropertyGroup
- Property
- AdjacentList
- VersionInfo (not sure, @yangxk1 )
Hey there, I submitted a pr of the proposed structure to keep the API access level consistent. It that's ok I will try looking to abstract the logic of the builder and specialize implementations to reduce boilerplate for each of the affected classes, else I can continue writing builders for each one of them but the implementation might be boilerplate heavy.
For the first answer, a discussion might be needed because it would require adding another layer of abstraction.
Hi @Jarvx200 , the EdgeInfo is just an example, here are all class that need builder:
Hi @Jarvx200 ,the PR for edgeInfo has been merged, Could you do this for other classes?
- VersionInfo (not sure, @yangxk1 )
yes, and userDefinedTypes is not necessary, defaults to new List()
Sure thing, will start working on them!
When done will attach the pr to this issue