Source:
<code>public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { List<CreateNetworkOptions.CreateNetworkRequest> createNetworkRequests = Lists.newArrayList(); for (BulkNetwork network : this.networks) { if (network.getNetworkType() != null) { if (network.getNetworkType() == NetworkType.FLAT) { checkNotNull(network.getPhysicalNetworkName(), "physicalNetworkName must be present when networkType=FLAT"); } else if (network.getNetworkType() == NetworkType.VLAN) { checkNotNull(network.getPhysicalNetworkName(), "physicalNetworkName must be present when networkType=VLAN"); checkNotNull(network.getSegmentationId(), "segmentationId must be present when networkType=VLAN"); } else if (network.getNetworkType() == NetworkType.GRE) { checkNotNull(network.getSegmentationId(), "segmentationId must be present when NetworkType=GRE"); } } <START> CreateNetworkOptions.CreateNetworkRequest createNetworkRequest = new CreateNetworkOptions.CreateNetworkRequest(); <END> if (network.getName() != null) createNetworkRequest.name = network.getName(); if (network.getAdminStateUp() != null) createNetworkRequest.admin_state_up = network.getAdminStateUp(); if (network.getExternal() != null) createNetworkRequest.external = network.getExternal(); if (network.getNetworkType() != null) createNetworkRequest.networkType = network.getNetworkType().getValue(); if (network.getPhysicalNetworkName() != null && (network.getNetworkType() == NetworkType.FLAT || network.getNetworkType() == NetworkType.VLAN)) createNetworkRequest.physicalNetworkName = network.getPhysicalNetworkName(); if (network.getSegmentationId() != null && (network.getNetworkType() == NetworkType.VLAN || network.getNetworkType() == NetworkType.GRE)) createNetworkRequest.segmentationId = network.getSegmentationId(); createNetworkRequests.add(createNetworkRequest); } return bindToRequest(request, ImmutableMap.of("networks", createNetworkRequests)); }</code><technical_language>Static import CreateNetworkRequest simplify this</technical_language>

Target:
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { List<CreateNetworkRequest> createNetworkRequests = Lists.newArrayList(); for (BulkNetwork network : this.networks) { if (network.getNetworkType() != null) { if (network.getNetworkType() == NetworkType.FLAT) { checkNotNull(network.getPhysicalNetworkName(), "physicalNetworkName must be present when networkType=FLAT"); } else if (network.getNetworkType() == NetworkType.VLAN) { checkNotNull(network.getPhysicalNetworkName(), "physicalNetworkName must be present when networkType=VLAN"); checkNotNull(network.getSegmentationId(), "segmentationId must be present when networkType=VLAN"); } else if (network.getNetworkType() == NetworkType.GRE) { checkNotNull(network.getSegmentationId(), "segmentationId must be present when NetworkType=GRE"); } } CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest(); if (network.getName() != null) createNetworkRequest.name = network.getName(); if (network.getAdminStateUp() != null) createNetworkRequest.admin_state_up = network.getAdminStateUp(); if (network.getExternal() != null) createNetworkRequest.external = network.getExternal(); if (network.getNetworkType() != null) createNetworkRequest.networkType = network.getNetworkType().getValue(); if (network.getPhysicalNetworkName() != null && (network.getNetworkType() == NetworkType.FLAT || network.getNetworkType() == NetworkType.VLAN)) createNetworkRequest.physicalNetworkName = network.getPhysicalNetworkName(); if (network.getSegmentationId() != null && (network.getNetworkType() == NetworkType.VLAN || network.getNetworkType() == NetworkType.GRE)) createNetworkRequest.segmentationId = network.getSegmentationId(); createNetworkRequests.add(createNetworkRequest); } return bindToRequest(request, ImmutableMap.of("networks", createNetworkRequests)); }