public static CompositeId fromString(String idString) { ArrayList<String> parts= new ArrayList<String>(); int commaIndex= idString.indexOf(','); while (commaIndex > 0) { int length= Integer.valueOf(idString.substring(0, commaIndex)).intValue(); String part= idString.substring(commaIndex+1, commaIndex+1+length); parts.add(part); idString= idString.substring(commaIndex+1+length); commaIndex= idString.indexOf(','); } String[] result= parts.toArray(new String[parts.size()]); return new CompositeId(result); }
public static CompositeId fromString(String idString) { ArrayList<String> parts= new ArrayList<>(); int commaIndex= idString.indexOf(','); while (commaIndex > 0) { int length= Integer.valueOf(idString.substring(0, commaIndex)).intValue(); String part= idString.substring(commaIndex+1, commaIndex+1+length); parts.add(part); idString= idString.substring(commaIndex+1+length); commaIndex= idString.indexOf(','); } String[] result= parts.toArray(new String[parts.size()]); return new CompositeId(result); }
/** * Returns a String that uniquely identifies the specified VM across all VM types. * * @param vm the instance of IVMInstallType to be identified * @return the unique identifier for the specified VM * * @since 2.1 */ public static String getCompositeIdFromVM(IVMInstall vm) { if (vm == null) { return null; } IVMInstallType vmType = vm.getVMInstallType(); String typeID = vmType.getId(); CompositeId id = new CompositeId(new String[] { typeID, vm.getId() }); return id.toString(); }
/** * Returns a String that uniquely identifies the specified VM across all VM types. * * @param vm the instance of IVMInstallType to be identified * @return the unique identifier for the specified VM * * @since 2.1 */ public static String getCompositeIdFromVM(IVMInstall vm) { if (vm == null) { return null; } IVMInstallType vmType = vm.getVMInstallType(); String typeID = vmType.getId(); CompositeId id = new CompositeId(new String[] { typeID, vm.getId() }); return id.toString(); }