incubator-graphar icon indicating copy to clipboard operation
incubator-graphar copied to clipboard

feat(java, info): builder design pattern for java-info

Open Thespica opened this issue 5 months ago • 6 comments

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

Thespica avatar Sep 02 '25 13:09 Thespica

Hey, could you assign me for this issue?

Jarvx200 avatar Sep 02 '25 18:09 Jarvx200

Hi @Jarvx200, Thank you for your interest in graphar, please refer to CONTRIBUTING.md

yangxk1 avatar Sep 03 '25 02:09 yangxk1

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 )

Thespica avatar Sep 03 '25 16:09 Thespica

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.

Jarvx200 avatar Sep 03 '25 17:09 Jarvx200

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?

yes, and userDefinedTypes is not necessary, defaults to new List()

yangxk1 avatar Sep 11 '25 11:09 yangxk1

Sure thing, will start working on them!

When done will attach the pr to this issue

Jarvx200 avatar Sep 12 '25 11:09 Jarvx200