public void addImport(String type) throws IOException {
    Matcher matcher = TYPE_PATTERN.matcher(type);
    if (!matcher.matches()) {
      throw new IllegalArgumentException(type);
    }
    if (importedTypes.put(type, matcher.group(1)) != null) {
      throw new IllegalArgumentException(type);
    }
    out.write("import ");
    out.write(type);
    out.write(";\n");
  }
public void addImport ( String type ) throws IOException { Matcher matcher = TYPE_PATTERN . matcher ( type ) ; if ( ! matcher . matches ( ) ) { throw new IllegalArgumentException ( type ) ; } if ( importedTypes . put ( type , matcher . group ( 1 ) ) != null ) { throw new IllegalArgumentException ( type ) ; } out . write ( "import " ) ; out . write ( type ) ; out . write ( ";\n" ) ; }
Emit an import for {@code type}. For the duration of the file, all
references to this class will be automatically shortened.