1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
# import org.netbeans.mobility.end2end.core.model.*;
# import org.netbeans.mobility.end2end.core.model.protocol.binary.ComplexTypeSerializer;
# import org.netbeans.mobility.end2end.core.model.classdata.*;
# import org.netbeans.mobility.end2end.core.model.protocol.Serializer;
# import java.util.*;
# import java.io.File;
#
# ProtocolSupport support = new ProtocolSupport(data, this, true);
# String outputDir = data.getClientOutputDirectory();
# ClassData[] types = data.getSupportedTypes();
# for( int i = 0; i < types.length; i++ ) {
# Serializer serializer = types[i].getSerializer();
# if(!( serializer instanceof ComplexTypeSerializer )) continue;
# ClassData beanType = types[i];
#
# String fileName = data.getClientRootDirectory() + File.separator + beanType.getClassName().replace( '.', File.separatorChar ) + ".java";
# setOut( fileName );
# getOutput().addCreatedFile( fileName );
# if( !beanType.getPackageName().equals( "" )) {
package ${beanType.getPackageName()};
# }
# FieldData[] fields = beanType.getFields();
# boolean vector = false, hashtable = false, date = false;
# for( int j = 0; j < fields.length; j++ ) {
# if( fields[j].isInherited()) continue;
# String className = fields[j].getType().getClassName();
# if( "java.util.Vector".equals( className )) {
# vector = true;
# } else if( "java.util.Hashtable".equals( className )) {
# hashtable = true;
# } else if( "java.util.Date".equals( className )) {
# date = true;
# }
# }
# if( vector ) {
import java.util.Vector;
# }
# if( hashtable ) {
import java.util.Hashtable;
# }
# if( date ) {
import java.util.Date;
# }
# if( "java.lang.Object".equals( beanType.getSuperClassName())) {
public class ${beanType.getLeafClassName()} {
# } else {
public class ${beanType.getLeafClassName()} extends ${beanType.getSuperClassName()} {
# }
# for( int j = 0; j < fields.length; j++ ) {
# if( fields[j].isInherited()) continue;
# String fieldTypeName = fields[j].getType().getClassName();
# if( fieldTypeName.startsWith( "java.lang" )) {
# fieldTypeName = fieldTypeName.substring( "java.lang.".length());
# }
public ${fieldTypeName} ${fields[j].getName()};
# }
}
#
# }
|