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

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


    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;
View Full Code Here


    } else {
      fileScope.append("ObjectValueBase");
    }
    fileScope.append(" implements " + typeClassName + " {\n");

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

    classScope.startLine("public static " + valueImplClassName + " parse(Object input)" +
        Util.THROWS_CLAUSE + " {\n");
    classScope.indentRight();
    subtypeAspect.writeParseMethodJava(classScope, valueImplClassName, "input");
    classScope.indentLeft();
    classScope.startLine("}");
    classScope.append("\n");
    classScope.startLine(valueImplClassName + "(Object input");
    subtypeAspect.writeSuperConstructorParamJava(classScope);
    classScope.append(")" + Util.THROWS_CLAUSE + " {\n");

    {
      MethodScope methodScope = classScope.newMethodScope();
      methodScope.indentRight();
      methodScope.startLine("super(input);\n");

      subtypeAspect.writeSuperConstructorInitializationJava(methodScope);

      for (FieldLoader fieldLoader : fieldLoaders) {
        String valueRef = methodScope.newMethodScopedName("value");
        String hasValueRef = methodScope.newMethodScopedName("hasValue");
        String fieldName = fieldLoader.getFieldName();
        methodScope.append("\n");
        Util.writeReadValueAndHasValue(methodScope, fieldName, "underlying", valueRef,
            hasValueRef);
        fieldLoader.writeFieldLoadJava(methodScope, valueRef, hasValueRef);
      }

      if (algCasesData != null) {
        algCasesData.writeConstructorCodeJava(methodScope);
      }

      methodScope.indentLeft();

    }

    classScope.startLine("}\n");

    for (VolatileFieldBinding field : volatileFields) {
      field.writeFieldDeclarationJava(classScope);
    }

    for (FieldLoader loader : this.fieldLoaders) {
      loader.writeFieldDeclarationJava(classScope);
    }

    if (algCasesData != null) {
      algCasesData.writeFiledsJava(classScope);
    }

    subtypeAspect.writeSuperFieldJava(classScope);

    for (Map.Entry<Method, MethodHandler> en : this.methodHandlerMap.entrySet()) {
      Method m = en.getKey();
      MethodHandler methodHandler = en.getValue();
      methodHandler.writeMethodImplementationJava(classScope, m);
    }

    BaseHandlersLibrary.writeBaseMethodsJava(classScope, this);

    subtypeAspect.writeHelperMethodsJava(classScope);

    classScope.indentLeft();
    classScope.startLine("}\n");
    fileScope.append("\n");
  }
View Full Code Here

TOP

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

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.