Should we use constants with builder methods in Java?

Say, I am creating an object using the builder pattern as follows:

CfnResolverProps props = CfnResolverProps.builder()

.apiId(“TestApiId”)

.typeName("Query")

.fieldName(“list”)

.dataSourceName(“SomeName”)

.build()

So, here, is it a good idea to make static constants variables for all the TestApiId, Query, list, SomeName? Or with builder pattern, it does not matter? For me, here, it doesn’t matter much because, here it is already readable code as builderPattern tells the name of the fields explicitly. What are the guidelines people use to use constants in Java?

submitted by /u/hatella
[link] [comments]

from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! https://ift.tt/2sWHTnd

Leave a comment

Design a site like this with WordPress.com
Get started
search previous next tag category expand menu location phone mail time cart zoom edit close