Use builder for ProxySslConfig
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/7b288f23 Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/7b288f23 Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/7b288f23 Branch: refs/heads/master Commit: 7b288f23aa427409faa047691abb26bd91bdfa45 Parents: f61c13c Author: Andrew Kennedy <[email protected]> Authored: Fri Aug 29 16:29:13 2014 +0100 Committer: Andrew Kennedy <[email protected]> Committed: Sat Aug 30 17:27:08 2014 +0100 ---------------------------------------------------------------------- .../brooklyn/entity/proxy/ProxySslConfig.java | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7b288f23/software/webapp/src/main/java/brooklyn/entity/proxy/ProxySslConfig.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/main/java/brooklyn/entity/proxy/ProxySslConfig.java b/software/webapp/src/main/java/brooklyn/entity/proxy/ProxySslConfig.java index 0d1be84..a61d401 100644 --- a/software/webapp/src/main/java/brooklyn/entity/proxy/ProxySslConfig.java +++ b/software/webapp/src/main/java/brooklyn/entity/proxy/ProxySslConfig.java @@ -35,9 +35,7 @@ import com.google.common.base.Objects; public class ProxySslConfig implements Serializable { private static final long serialVersionUID = -2692754611458939617L; - private static final Logger LOG = LoggerFactory.getLogger(ProxySslConfig.class); - private static final AtomicBoolean initialized = new AtomicBoolean(false); /** Setup type coercion. */ @@ -49,24 +47,24 @@ public class ProxySslConfig implements Serializable { @Override public ProxySslConfig apply(final Map input) { Map map = MutableMap.copyOf(input); - ProxySslConfig sslConfig = new ProxySslConfig(); - sslConfig.certificateSourceUrl = (String) map.remove("certificateSourceUrl"); - sslConfig.keySourceUrl = (String) map.remove("keySourceUrl"); - sslConfig.certificateDestination = (String) map.remove("certificateDestination"); - sslConfig.keyDestination = (String) map.remove("keyDestination"); + ProxySslConfig.Builder sslConfig = ProxySslConfig.builder() + .certificateSourceUrl((String) map.remove("certificateSourceUrl")) + .keySourceUrl((String) map.remove("keySourceUrl")) + .certificateDestination((String) map.remove("certificateDestination")) + .keyDestination((String) map.remove("keyDestination")); Object targetIsSsl = map.remove("targetIsSsl"); if (targetIsSsl != null) { - sslConfig.targetIsSsl = TypeCoercions.coerce(targetIsSsl, Boolean.TYPE); + sslConfig.targetIsSsl(TypeCoercions.coerce(targetIsSsl, Boolean.TYPE)); } Object reuseSessions = map.remove("reuseSessions"); if (reuseSessions != null) { - sslConfig.reuseSessions = TypeCoercions.coerce(reuseSessions, Boolean.TYPE); + sslConfig.reuseSessions(TypeCoercions.coerce(reuseSessions, Boolean.TYPE)); } if (!map.isEmpty()) { LOG.info("Extra unused keys found in ProxySslConfig config: [{}]", Joiner.on(",").withKeyValueSeparator("=").join(map)); } - return sslConfig; + return sslConfig.build(); } }); } @@ -247,7 +245,7 @@ public class ProxySslConfig implements Serializable { public void setReuseSessions(boolean reuseSessions) { this.reuseSessions = reuseSessions; } - + // autogenerated hash code and equals; nothing special required @Override
