Package org.jboss.errai.marshalling.rebind.api

Examples of org.jboss.errai.marshalling.rebind.api.MappingStrategy


    constructor.finish();
  }

  private Statement marshal(MetaClass cls) {
    final MappingStrategy strategy = MappingStrategyFactory
            .createStrategy(target == MarshallerOuputTarget.GWT, mappingContext, cls);
    if (strategy == null) {
      throw new RuntimeException("no available marshaller for class: " + cls.getName());
    }
    return strategy.getMapper().getMarshaller();
  }
View Full Code Here


  private void generateMarshaller(final GeneratorContext context, final MetaClass type, final String className,
          final String marshallerTypeName, final TreeLogger logger, final PrintWriter printWriter) {
   
    MarshallerOutputTarget target = MarshallerOutputTarget.GWT;
    final MappingStrategy strategy =
        MappingStrategyFactory.createStrategy(true, GeneratorMappingContextFactory.getFor(context, target), type);

    String gen = null;
    if (type.isArray()) {
      BuildMetaClass marshallerClass =
          MarshallerGeneratorFactory.generateArrayMarshaller(type, marshallerTypeName, true);
      gen = marshallerClass.toJavaString();
    }
    else {
      final ClassStructureBuilder<?> marshaller = strategy.getMapper().getMarshaller(marshallerTypeName);
      gen = marshaller.toJavaString();
    }
    printWriter.append(gen);

    final File tmpFile = new File(RebindUtils.getErraiCacheDir().getAbsolutePath() + "/" + className + ".java");
View Full Code Here

                .implementsInterface(
                    MetaClassFactory.get(GeneratedMarshaller.class))
                .body().getClassDefinition();
      }
      else {
        final MappingStrategy strategy = MappingStrategyFactory
            .createStrategy(false, GeneratorMappingContextFactory.getFor(context, target), type);

        String marshallerClassName =
            MarshallerGeneratorFactory.MARSHALLER_NAME_PREFIX + MarshallingGenUtil.getVarName(type) + "Impl";

        final ClassStructureBuilder<?> marshaller = strategy.getMapper().getMarshaller(marshallerClassName);
        customMarshaller = marshaller.getClassDefinition();
      }
      classStructureBuilder.declaresInnerClass(new InnerClass(customMarshaller));
      addMarshaller(customMarshaller, type);
    }
View Full Code Here

TOP

Related Classes of org.jboss.errai.marshalling.rebind.api.MappingStrategy

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.