Code example for PrintWriter

Methods: printf

0
     * Represents all the fields in a VLAN 
     */ 
    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", "taggedPIF", this.taggedPIF);
            print.printf("%1$20s: %2$s\n", "untaggedPIF", this.untaggedPIF);
            print.printf("%1$20s: %2$s\n", "tag", this.tag);
            print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
            return writer.toString();
        } 
 
        /** 
         * Convert a VLAN.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("tagged_PIF", this.taggedPIF == null ? new PIF("OpaqueRef:NULL") : this.taggedPIF);