writer.write("Types potentially sent from browser:\n");
writer.write("====================================\n\n");
writer.flush();
typesSentToBrowserBuilder.setLogOutputWriter(writer);
SerializableTypeOracle typesSentFromBrowser = typesSentFromBrowserBuilder.build(logger);
writer.write("===================================\n");
writer.write("Types potentially sent from server:\n");
writer.write("===================================\n\n");
writer.flush();
typesSentFromBrowserBuilder.setLogOutputWriter(writer);
SerializableTypeOracle typesSentToBrowser = typesSentToBrowserBuilder.build(logger);
writer.close();
if (pathInfo != null) {
context.commitResource(logger, pathInfo).setPrivate(true);
}
// Create the serializer
String modifiedTypeName = typeName.replace('.', '_') + "Serializer";
TypeSerializerCreator tsc = new TypeSerializerCreator(logger, typesSentFromBrowser, typesSentToBrowser, context, "comet." + modifiedTypeName, modifiedTypeName);
String realize = tsc.realize(logger);
// Create the CometSerializer impl
ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(packageName, className);
composerFactory.addImport(Serializer.class.getName());
composerFactory.addImport(SerialMode.class.getName());
composerFactory.setSuperclass(typeName);
// TODO is the SERIALIZER required for DE RPC?
SourceWriter sourceWriter = composerFactory.createSourceWriter(context, printWriter);
sourceWriter.print("private Serializer SERIALIZER = new " + realize + "();");
sourceWriter.print("protected Serializer getSerializer() {return SERIALIZER;}");
sourceWriter.print("public SerialMode getMode() {return SerialMode." + annotation.mode().name() + ";}");
sourceWriter.commit(logger);
if (annotation.mode() == SerialMode.DE_RPC) {
RpcDataArtifact data = new RpcDataArtifact(type.getQualifiedSourceName());
for (JType t : typesSentToBrowser.getSerializableTypes()) {
if (!(t instanceof JClassType)) {
continue;
}
JField[] serializableFields = SerializationUtils.getSerializableFields(context.getTypeOracle(), (JClassType) t);