Package org.jboss.errai.codegen.meta.impl.build

Examples of org.jboss.errai.codegen.meta.impl.build.BuildMetaClass


    ClassStructureBuilder<?> classStructureBuilder =
            Implementations.implement(Bootstrapper.class, packageName, className);

    logger.log(com.google.gwt.core.ext.TreeLogger.Type.DEBUG, "Generating IOC Bootstrapper " + packageName + "." + className);

    BuildMetaClass bootStrapClass = classStructureBuilder.getClassDefinition();
    Context buildContext = bootStrapClass.getContext();

    BlockBuilder<?> blockBuilder =
            classStructureBuilder.publicMethod(BootstrapperInjectionContext.class, "bootstrapContainer")
                    .methodComment("The main IOC bootstrap method.");
View Full Code Here


        Implementations.implement(Bootstrapper.class, packageName, className);

    logger.log(com.google.gwt.core.ext.TreeLogger.Type.DEBUG, "Generating IOC Bootstrapper "
        + packageName + "." + className);

    final BuildMetaClass bootStrapClass = classStructureBuilder.getClassDefinition();
    final Context buildContext = bootStrapClass.getContext();

    final MetaClass Annotation_MC = MetaClassFactory.get(Annotation.class);

    buildContext.addInterningCallback(new InterningCallback() {
      private final Map<Set<Annotation>, String> cachedArrays = new HashMap<Set<Annotation>, String>();
View Full Code Here

  public static MetaClass parameterizedAs(MetaClass clazz, MetaParameterizedType parameterizedType) {
    return cloneToBuildMetaClass(clazz, parameterizedType);
  }

  public static MetaClass erasedVersionOf(MetaClass clazz) {
    BuildMetaClass mc = cloneToBuildMetaClass(clazz);
    mc.setParameterizedType(null);
    return mc;
  }
View Full Code Here

  private static BuildMetaClass cloneToBuildMetaClass(MetaClass clazz) {
    return cloneToBuildMetaClass(clazz, null);
  }

  private static BuildMetaClass cloneToBuildMetaClass(MetaClass clazz, MetaParameterizedType parameterizedType) {
    BuildMetaClass buildMetaClass = new BuildMetaClass(Context.create(), clazz.getFullyQualifiedName());

    buildMetaClass.setReifiedFormOf(clazz);
    buildMetaClass.setAbstract(clazz.isAbstract());
    buildMetaClass.setFinal(clazz.isFinal());
    buildMetaClass.setStatic(clazz.isStatic());
    buildMetaClass.setInterface(clazz.isInterface());
    buildMetaClass.setInterfaces(Arrays.asList(clazz.getInterfaces()));
    buildMetaClass.setScope(GenUtil.scopeOf(clazz));
    buildMetaClass.setSuperClass(clazz.getSuperClass());

    for (MetaTypeVariable typeVariable : clazz.getTypeParameters()) {
      buildMetaClass.addTypeVariable(typeVariable);
    }

    if (parameterizedType != null) {
      buildMetaClass.setParameterizedType(parameterizedType);
    }
    else {
      buildMetaClass.setParameterizedType(clazz.getParameterizedType());
    }

    for (MetaField field : clazz.getDeclaredFields()) {
      BuildMetaField bmf = new ShadowBuildMetaField(buildMetaClass, EmptyStatement.INSTANCE,
              GenUtil.scopeOf(field), field.getType(), field.getName(), field);

      bmf.setFinal(field.isFinal());
      bmf.setStatic(field.isStatic());
      bmf.setVolatile(field.isVolatile());
      bmf.setTransient(field.isTransient());

      buildMetaClass.addField(bmf);
    }

    for (MetaConstructor c : clazz.getDeclaredConstructors()) {
      BuildMetaConstructor newConstructor = new BuildMetaConstructor(buildMetaClass, EmptyStatement.INSTANCE,
              GenUtil.scopeOf(c),
              DefParameters.from(c));
      newConstructor.setReifiedFormOf(c);

      buildMetaClass.addConstructor(newConstructor);
    }

    for (MetaMethod method : clazz.getDeclaredMethods()) {
      MetaClass returnType = method.getReturnType();
      if (method.getGenericReturnType() instanceof MetaTypeVariable) {
        MetaTypeVariable typeVariable = (MetaTypeVariable) method.getGenericReturnType();
        MetaClass tVarVal = getTypeVariableValue(typeVariable, buildMetaClass);
        if (tVarVal != null) {
          returnType = tVarVal;
        }
      }

      List<Parameter> parameters = new ArrayList<Parameter>();
      int i = 0;
      for (MetaParameter parm : method.getParameters()) {
        MetaClass parmType = null;
        if (method.getGenericParameterTypes() != null) {
          if (method.getGenericParameterTypes()[i] instanceof MetaTypeVariable) {
            MetaTypeVariable typeVariable = (MetaTypeVariable) method.getGenericParameterTypes()[i];

            MetaClass tVarVal = getTypeVariableValue(typeVariable, buildMetaClass);
            if (tVarVal != null) {
              parmType = tVarVal;
            }
          }
        }

        if (parmType == null) {
          parmType = parm.getType();
        }

        parameters.add(Parameter.of(parmType, parm.getName()));
        i++;
      }

      BuildMetaMethod newMethod = new ShadowBuildMetaMethod(buildMetaClass, EmptyStatement.INSTANCE,
              GenUtil.scopeOf(method), GenUtil.modifiersOf(method), method.getName(), returnType,
              method.getGenericReturnType(),
              DefParameters.fromParameters(parameters), ThrowsDeclaration.of(method.getCheckedExceptions()), method);

      newMethod.setReifiedFormOf(method);

      buildMetaClass.addMethod(newMethod);
    }

    return buildMetaClass;
  }
View Full Code Here

    // Now generate code to load up each of the JSON files and register them
    // with the translation service.
    for (String resource : resources) {
      // Generate this component's ClientBundle resource interface
      BuildMetaClass messageBundleResourceInterface = generateMessageBundleResourceInterface(resource);
      // Add it as an inner class to the generated translation service
      classBuilder.getClassDefinition().addInnerClass(new InnerClass(messageBundleResourceInterface));

      // Instantiate the ClientBundle MessageBundle resource
      final String msgBundleVarName = InjectUtil.getUniqueVarName();
View Full Code Here

      final MappingStrategy strategy =
          MappingStrategyFactory.createStrategy(true, GeneratorMappingContextFactory.getFor(context, target), type);

      String gen = null;
      if (type.isArray()) {
        BuildMetaClass marshallerClass =
            MarshallerGeneratorFactory.generateArrayMarshaller(type, packageName + "." + className, true);
        gen = marshallerClass.toJavaString();
      }
      else {
        final ClassStructureBuilder<?> marshaller =
            strategy.getMapper().getMarshaller(packageName + "." + className);
        gen = marshaller.toJavaString();
View Full Code Here

    ClassStructureBuilder<?> classStructureBuilder =
            Implementations.implement(Bootstrapper.class, packageName, className);

    logger.log(com.google.gwt.core.ext.TreeLogger.Type.DEBUG, "Generating IOC Bootstrapper " + packageName + "." + className);

    BuildMetaClass bootStrapClass = classStructureBuilder.getClassDefinition();
    Context buildContext = bootStrapClass.getContext();

    BlockBuilder<?> blockBuilder =
            classStructureBuilder.publicMethod(BootstrapperInjectionContext.class, "bootstrapContainer")
                    .methodComment("The main IOC bootstrap method.");
View Full Code Here

        Implementations.implement(Bootstrapper.class, packageName, className);

    logger.log(com.google.gwt.core.ext.TreeLogger.Type.DEBUG, "Generating IOC Bootstrapper "
        + packageName + "." + className);

    final BuildMetaClass bootStrapClass = classStructureBuilder.getClassDefinition();
    final Context buildContext = bootStrapClass.getContext();

    buildContext.addInterningCallback(new BootstrapInterningCallback(classStructureBuilder, buildContext));

    final BlockBuilder<?> blockBuilder =
        classStructureBuilder.publicMethod(contextClass, "bootstrapContainer")
View Full Code Here

  static final String RENDERED_PROXIES = "^RenderedProxies";


  public List<Statement> createProxyDeclaration(InjectionContext context, Statement beanRef) {
    if (isProxied()) {
      final BuildMetaClass type = ProxyMaker.makeProxy(
          getInjectedType(),
          context.getProcessingContext().isGwtTarget() ? "jsni" : "reflection",
          getProxyPropertyMap(),
          getWeavingStatementsMap()
      );

      if (!context.hasAttribute(RENDERED_PROXIES)) {
        context.setAttribute(RENDERED_PROXIES, new HashSet<String>());

      }
      final Set<String> proxies = (Set<String>) context.getAttribute(RENDERED_PROXIES);
      if (!proxies.contains(type.getCanonicalName())) {
        context.getProcessingContext().getBootstrapClass()
            .addInnerClass(new InnerClass(type));
        proxies.add(type.getCanonicalName());
      }

      final List<Statement> proxyCloseStmts = new ArrayList<Statement>();

      proxyCloseStmts.add(Stmt.declareFinalVariable(
View Full Code Here

      // Now generate code to load up each of the JSON files and register them
      // with the translation service.
      for (String resource : resources) {
        // Generate this component's ClientBundle resource interface
        BuildMetaClass messageBundleResourceInterface = generateMessageBundleResourceInterface(resource);
        // Add it as an inner class to the generated translation service
        classBuilder.getClassDefinition().addInnerClass(new InnerClass(messageBundleResourceInterface));

        // Instantiate the ClientBundle MessageBundle resource
        final String msgBundleVarName = InjectUtil.getUniqueVarName();
View Full Code Here

TOP

Related Classes of org.jboss.errai.codegen.meta.impl.build.BuildMetaClass

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.