Package org.chromium.sdk.internal.protocolparser.dynamicimpl.JavaCodeGenerator

Examples of org.chromium.sdk.internal.protocolparser.dynamicimpl.JavaCodeGenerator.FileScope


      String className, Collection<GeneratedCodeMap> basePackages) {
    JavaCodeGenerator generator = new JavaCodeGenerator.Impl();

    GlobalScope globalScope = generator.newGlobalScope(type2TypeHandler.values(), basePackages);

    FileScope fileScope = globalScope.newFileScope(stringBuilder);

    fileScope.startLine("// This is a generated source.\n");
    fileScope.startLine("// See " + this.getClass().getName() + " for details\n");
    fileScope.append("\n");
    fileScope.startLine("package " + packageName + ";\n");
    fileScope.append("\n");
    fileScope.startLine("public class " + className + " implements " +
        rootImpl.getType().getCanonicalName() + " {\n");

    ClassScope rootClassScope = fileScope.newClassScope();
    rootClassScope.indentRight();

    rootImpl.writeStaticMethodJava(rootClassScope);

    for (TypeHandler<?> typeHandler : type2TypeHandler.values()) {
      typeHandler.writeStaticClassJava(rootClassScope);
    }

    rootClassScope.writeClassMembers();

    rootClassScope.indentLeft();

    rootClassScope.startLine("}\n");

    Map<Class<?>, String> type2ImplClassName = new HashMap<Class<?>, String>();
    for (TypeHandler<?> typeHandler : type2TypeHandler.values()) {
      String shortName = fileScope.getTypeImplShortName(typeHandler);
      String fullReference = packageName + "." + className + "." + shortName;
      type2ImplClassName.put(typeHandler.getTypeClass(), fullReference);
    }

    return new GeneratedCodeMap(type2ImplClassName);
View Full Code Here

TOP

Related Classes of org.chromium.sdk.internal.protocolparser.dynamicimpl.JavaCodeGenerator.FileScope

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.