Code example for PrintWriter

Methods: printf

0
     * Represents all the fields in a VTPM 
     */ 
    public static class Record implements Types.Record { 
        public String toString() {
            StringWriter writer = new StringWriter();
            PrintWriter print = new PrintWriter(writer);
            print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
            print.printf("%1$20s: %2$s\n", "VM", this.VM);
            print.printf("%1$20s: %2$s\n", "backend", this.backend);
            return writer.toString();
        } 
 
        /** 
         * Convert a VTPM.Record to a Map 
         */ 
        public Map<String,Object> toMap() {
            Map<String,Object> map = new HashMap<String,Object>();
            map.put("uuid", this.uuid == null ? "" : this.uuid);
            map.put("VM", this.VM == null ? new VM("OpaqueRef:NULL") : this.VM);
            map.put("backend", this.backend == null ? new VM("OpaqueRef:NULL") : this.backend);
            return map;