1.后台对象的参数需要是是list对象
1 /* 2 * copyright : GLOBALROAM Ptd Ltd 3 * VmCreateInfo.java 4 * Author: 5 * zhangpengyangming 6 * Date: 7 * 2015/11/12 0012 8 * Version: 9 * 1.0 10 * Revisions: 11 * This class is used for load information to create VM 12 */ 13 package com.globalroam.iaas.hoverv.domain.dashboard.virtual; 14 15 import java.io.Serializable; 16 import java.util.List; 17 18 /** 19 * VmCreateInfo 20 * This class is used for load information to create VM 21 * @author zhangpengyangming 22 * @version 1.0 23 * @date 2015/11/12 0012 24 */ 25 public class VmCreateInfo implements Serializable { 26 private String availabilityZone; 27 private String tagName;//instance group name 28 private String instanceCount; 29 private String imageUuid; 30 private String flavorId; 31 private List<String> netWorks; 参数对应的list 32 private String securityGroup; 33 34 public String getAvailabilityZone() { 35 return availabilityZone; 36 } 37 38 public void setAvailabilityZone(String availabilityZone) { 39 this.availabilityZone = availabilityZone; 40 } 41 42 public String getTagName() { 43 return tagName; 44 } 45 46 public void setTagName(String tagName) { 47 this.tagName = tagName; 48 } 49 50 public String getInstanceCount() { 51 return instanceCount; 52 } 53 54 public void setInstanceCount(String instanceCount) { 55 this.instanceCount = instanceCount; 56 } 57 58 public String getImageUuid() { 59 return imageUuid; 60 } 61 62 public void setImageUuid(String imageUuid) { 63 this.imageUuid = imageUuid; 64 } 65 66 public String getFlavorId() { 67 return flavorId; 68 } 69 70 public void setFlavorId(String flavorId) { 71 this.flavorId = flavorId; 72 } 73 74 public List<String> getNetWorks() { 75 return netWorks; 76 } 77 78 public void setNetWorks(List<String> netWorks) { 79 this.netWorks = netWorks; 80 } 81 82 public String getSecurityGroup() { 83 return securityGroup; 84 } 85 86 public void setSecurityGroup(String securityGroup) { 87 this.securityGroup = securityGroup; 88 } 89 90 @Override 91 public String toString() { 92 return "VmCreateInfo{" + 93 "availabilityZone=‘" + availabilityZone + ‘\‘‘ + 94 ", tagName=‘" + tagName + ‘\‘‘ + 95 ", instanceCount=‘" + instanceCount + ‘\‘‘ + 96 ", imageUuid=‘" + imageUuid + ‘\‘‘ + 97 ", flavorId=‘" + flavorId + ‘\‘‘ + 98 ", netWorks=" + netWorks + 99 ", securityGroup=‘" + securityGroup + ‘\‘‘ + 100 ‘}‘; 101 } 102 }
2.将获得的数组转换成对象
var arr = []
转换对象:
1 /*实现数组的remove*/ 2 Array.prototype.indexOf = function(val) { 3 for (var i = 0; i < this.length; i++) { 4 if (this[i] == val) return i; 5 } 6 return -1; 7 }; 8 Array.prototype.remove = function(val) { 9 var index = this.indexOf(val); 10 if (index > -1) { 11 this.splice(index, 1); 12 } 13 }; 14 15 //原生向数组中添加元素的push方法netWorksArr.push() 16 var netWorksArr = []; 17 18 var jsArr = {}; 19 for(var i = 0; i < netWorksArr.length; i++) { 20 jsArr[i] = netWorksArr[i]; 21 }
js中的对象才能对应java中的list对象,否则会报NumberFormatException
时间: 2024-11-08 19:01:58