FileDocCategorySizeDatePackage
RemoteInterfaceGenerator.javaAPI DocphoneME MR2 API (J2ME)4337Wed May 02 18:00:34 BST 2007com.sun.j2mews.sg

RemoteInterfaceGenerator

public class RemoteInterfaceGenerator extends AbstractGenerator implements ProcessorAction
Generate the Remote Interface.

Fields Summary
Constructors Summary
public RemoteInterfaceGenerator()

    
Methods Summary
protected voidgenerateClass()

        jw.write("public interface ", className, " extends java.rmi.Remote ");
        jw.begin();

        JavaInterface intf = port.getJavaInterface();
        for (Iterator it = intf.getMethods(); it.hasNext();) {
            JavaMethod method = (JavaMethod) it.next();
            generateUserMethod(method);
        }
        
        jw.end();  // end interface
    
protected voidgenerateUserMethod(JavaMethod method)

        String methodName = method.getName();
        JavaType returnType = getExpandedReturnType(method);
        String returnTypeName = javaTypeToString(returnType);
        boolean voidReturnType = (returnType == null || "void".equals(returnTypeName));
        jw.write("public ");
        if (voidReturnType) {
            jw.write("void");
        } else {
            jw.write(returnTypeName);
        }
        jw.write(" ");
        jw.write(methodName);
        jw.write("(");
        jw.setFirst(", ");
        List parameterList = getExpandedParametersList(method);
        for (Iterator parameters = parameterList.iterator(); parameters.hasNext(); ) {
            JavaParameter parameter = (JavaParameter) parameters.next();
            JavaType parameterType = parameter.getType();
            String paramTypeName = javaTypeToString(parameterType);
            jw.writeNext(paramTypeName, " ", parameter.getName());
        }
        jw.write(")");
        jw.write(" throws java.rmi.RemoteException");
        for (Iterator exceptions = method.getExceptions();
             exceptions.hasNext(); ) {
            String exceptionName = (String) exceptions.next();
            jw.write(", ");
            jw.write(exceptionName);
        }
        jw.eol();
        jw.cr();
    
protected java.lang.StringgetFullClassName()

        JavaInterface intf = port.getJavaInterface();
        return env.getNames().customJavaTypeClassName(intf);
    
protected java.io.FilegetSourceFile()

        return env.getNames().sourceFileForClass(fullClassName, fullClassName, sourceDir, env);
    
protected java.lang.StringgetSourceFileType()

        return GeneratorConstants.FILE_TYPE_REMOTE_INTERFACE;