1 16 package com.google.gwt.dev.util.msg; 17 18 import com.google.gwt.core.ext.TreeLogger; 19 import com.google.gwt.core.ext.TreeLogger.Type; 20 21 24 public abstract class Message1 extends Message { 25 26 public Message1(Type type, String fmt) { 27 super(type, fmt, 1); 28 } 29 30 protected TreeLogger branch1(TreeLogger logger, Object arg1, Formatter fmt1, 31 Throwable caught) { 32 return logger.branch(type, compose1(arg1, fmt1), caught); 33 } 34 35 protected String compose1(Object arg1, Formatter fmt1) { 36 String stringArg1 = (arg1 != null ? fmt1.format(arg1) : "null"); 39 40 String insert1 = stringArg1; 43 44 int lenInsert1 = insert1.length(); 47 48 int lenPart0 = fmtParts[0].length; 51 int lenPart1 = fmtParts[1].length; 52 53 int dest = 0; 56 char[] chars = new char[minChars + lenInsert1]; 57 58 System.arraycopy(fmtParts[0], 0, chars, dest, lenPart0); 60 dest += lenPart0; 61 62 insert1.getChars(0, lenInsert1, chars, dest); 63 dest += lenInsert1; 64 65 System.arraycopy(fmtParts[1], 0, chars, dest, lenPart1); 67 68 return new String (chars); 69 } 70 71 protected void log1(TreeLogger logger, Object arg1, Formatter fmt1, 72 Throwable caught) { 73 if (logger.isLoggable(type)) { 74 logger.log(type, compose1(arg1, fmt1), caught); 75 } 76 } 77 } 78 | Popular Tags |