private CharSequence transform(FormatToken token, Object argument) {
    this.formatToken = token;
    this.arg = argument;

    // There are only two format specifiers that matter: "%d" and "%s".
    // Nothing else is common in the wild. We fast-path these two to
    // avoid the heavyweight machinery needed to cope with flags, width,
    // and precision.
    if (token.isDefault()) {
      switch (token.getConversionType()) {
        case 's':
          if (arg == null) {
            return "null";
          }
          // fall through
        case 'd':
          if (arg instanceof Integer
              || arg instanceof Long
              || arg instanceof Short
              || arg instanceof Byte) {
            String result = arg.toString();
            return result;
          }
      }
    }

    formatToken.checkFlags(arg);
    CharSequence result;
    switch (token.getConversionType()) {
      case 'B':
      case 'b':
        result = transformFromBoolean();
        break;
      case 'H':
      case 'h':
        result = transformFromHashCode();
        break;
      case 'S':
      case 's':
        result = transformFromString();
        break;
      case 'C':
      case 'c':
        result = transformFromCharacter();
        break;
      case 'd':
      case 'o':
      case 'x':
      case 'X':
        result = transformFromInteger();
        break;
      case 'A':
      case 'a':
      case 'E':
      case 'e':
      case 'f':
      case 'G':
      case 'g':
        result = transformFromFloat();
        break;
      case '%':
        result = transformFromPercent();
        break;
      case 'n':
        result = transformFromLineSeparator();
        break;
      case 't':
      case 'T':
        result = transformFromDateTime();
        break;
      default:
        throw token.unknownFormatConversionException();
    }

    if (Character.isUpperCase(token.getConversionType()) && result != null) {
      result = Ascii.toUpperCase(result.toString());
    }
    return result;
  }
private CharSequence transform ( FormatToken token , Object argument ) { this . formatToken = token ; this . arg = argument ; if ( token . isDefault ( ) ) { switch ( token . getConversionType ( ) ) { case 's' : if ( arg == null ) { return "null" ; } case 'd' : if ( arg instanceof Integer || arg instanceof Long || arg instanceof Short || arg instanceof Byte ) { String result = arg . toString ( ) ; return result ; } } } formatToken . checkFlags ( arg ) ; CharSequence result ; switch ( token . getConversionType ( ) ) { case 'B' : case 'b' : result = transformFromBoolean ( ) ; break ; case 'H' : case 'h' : result = transformFromHashCode ( ) ; break ; case 'S' : case 's' : result = transformFromString ( ) ; break ; case 'C' : case 'c' : result = transformFromCharacter ( ) ; break ; case 'd' : case 'o' : case 'x' : case 'X' : result = transformFromInteger ( ) ; break ; case 'A' : case 'a' : case 'E' : case 'e' : case 'f' : case 'G' : case 'g' : result = transformFromFloat ( ) ; break ; case '%' : result = transformFromPercent ( ) ; break ; case 'n' : result = transformFromLineSeparator ( ) ; break ; case 't' : case 'T' : result = transformFromDateTime ( ) ; break ; default : throw token . unknownFormatConversionException ( ) ; } if ( Character . isUpperCase ( token . getConversionType ( ) ) && result != null ) { result = Ascii . toUpperCase ( result . toString ( ) ) ; } return result ; }
/*
Gets the formatted string according to the format token and the
argument.