我的应用程序通过将“服务请求”对象传递给该服务来通过 PUT 调用其他一些服务。但是,我们需要与一些新服务的集成来维护 3 个不同版本的服务请求。我查看了 wikipedia 和其他几个站点中的 Builder Pattern 文档,但找不到任何东西可以确认我可以在我的用例中使用 builder 模式。
我们需要的三个版本的服务请求对象是:
Version 1:
{
id: "SomeGlConsumer",
parameters: {
m_id: 44551,
m1_id: 695831032,
r1: "EU",
r2: "xyz",
o1: 30,
l1: 130,
g1: "alksja",
g2: 75,
g3: "akjsa",
g4: 2040,
p1: "aks;alksa"
c1: "http:/xyz.com/services/gl"
}
}
version 2:
{
id: "SomeGlConsumer",
parameters: {
m1: 44551,
m2: 695831032,
r1: "EU",
r2: "xyz",
o1: 30,
l1: 130,
g: [
{
g1: "lksaskasa",
g2: 228,
g3: "alksjajslkajs",
g4: 8400,
p1: "kjsasjajsjak"
},
{
g1: "aslalsalksa",
g2: 396,
g3: "ajksaj",
g4: 6350,
p1: "akjsasa"
},
{
g1: "ajsajsa",
g2: 397,
g3: "aslalksa",
g4: 6350,
p1: "lkasal"
}
],
c1: "http://abc.com/services/gl"
}
}
version 3:
{
c1: "Contribution Profit",
c2: "http://abc.com/services/notifySetupStatus",
a1:834,
c3: {
l1: 03/30/2013
},
m: {
m1: 44551,
m2: 695831032,
r1: "EU",
r2: "haasla",
s1: "ES",
o1: 30,
l2: 130
},
g: [
{
g1: "aasassla",
g2: 228,
g3: "lkaskaskja",
g4: 8400,
p1: "ls;aksas",
p2: "alsalska" (Optional)
},
{
g1: "aasassla",
g2: 228,
g3: "lkaskaskja",
g4: 8400,
p1: "ls;aksas",
},
{
g1: "aasassla",
g2: 228,
g3: "lkaskaskja",
g4: 8400,
p1: "ls;aksas",
}
],
xyzservice_config: [ # service specific bucket
{
g1: "alksaks",
c1: "kaskas"
},
{
g1: "akslaksa",
},
{
g1: "aslaksa",
},
]
}