org.restlet.rebind
Class ClientProxyGenerator

java.lang.Object
  extended by com.google.gwt.core.ext.Generator
      extended by org.restlet.rebind.ClientProxyGenerator

public class ClientProxyGenerator
extends Generator

Deferred binding generator capable of creating a subclass of ClientProxy implementing a custom Java interface, extending the marker ClientProxy interface, and annotated with Restlet annotations such as Get, Post, Put or Delete.

Author:
Jerome Louvel

Constructor Summary
ClientProxyGenerator()
          Default constructor.
 
Method Summary
 String generate(TreeLogger logger, GeneratorContext context, String typeQName)
           
protected  void generateContructor()
          Generates the default constructor.
protected  void generateFields(com.google.gwt.user.rebind.rpc.SerializableTypeOracle serializableTypeOracle)
          Generates the private members of the proxy class.
protected  void generateMethod(Method method)
          Generates the code of a given Java method (must be correctly annotated using Restlet annotation).
protected  void generateProxy()
          Generates the code of the proxy class.
protected  void generateSerializers()
          Generates the code of the necessary object serializers.
protected  String getClassName()
          Returns the name of the proxy class that will be generated.
protected  JClassType getClassType()
          Returns the parent type.
protected  GeneratorContext getContext()
          Returns the context object that provides metadata to defered binding generators.
protected  TreeLogger getLogger()
          Returns the logger used by the deferred binding generator.
protected  String getPackageName()
          Returns the package name of the parent type.
protected  com.google.gwt.user.rebind.SourceWriter getSourceWriter()
          Returns the writer used for the content of the proxy class.
protected  com.google.gwt.user.rebind.rpc.SerializableTypeOracle getSto()
          Returns the serializer class.
protected  com.google.gwt.user.rebind.rpc.SerializableTypeOracleBuilder getStob()
          Returns the builder of the serializer class.
protected  TypeOracle getTypeOracle()
          Returns the type oracle for the current generator context.
protected  String getTypeQName()
          Returns the parent type for which a default constructible subclass will be generated.
protected  void indent()
          Increments the indentation of the generated source code.
protected  void outdent()
          Decrements the indentation of the generated source code.
protected  void print(String value)
          Prints the given value in the generated source code.
protected  void println()
          Terminates the current line with a new line separator.
protected  void println(String value)
          Prints the given value in the generated source code and terminates the current line with a new line separator.
 
Methods inherited from class com.google.gwt.core.ext.Generator
escape
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientProxyGenerator

public ClientProxyGenerator()
Default constructor.

Method Detail

generate

public String generate(TreeLogger logger,
                       GeneratorContext context,
                       String typeQName)
                throws UnableToCompleteException
Specified by:
generate in class Generator
Throws:
UnableToCompleteException

generateContructor

protected void generateContructor()
Generates the default constructor.


generateFields

protected void generateFields(com.google.gwt.user.rebind.rpc.SerializableTypeOracle serializableTypeOracle)
Generates the private members of the proxy class.

Parameters:
serializableTypeOracle - The type of the object serializer/deserializer.

generateMethod

protected void generateMethod(Method method)
                       throws Exception
Generates the code of a given Java method (must be correctly annotated using Restlet annotation).

Parameters:
method - The Java method.
Throws:
Exception

generateProxy

protected void generateProxy()
                      throws Exception
Generates the code of the proxy class.

Throws:
Exception

generateSerializers

protected void generateSerializers()
                            throws UnableToCompleteException
Generates the code of the necessary object serializers.

Throws:
UnableToCompleteException

getClassName

protected String getClassName()
Returns the name of the proxy class that will be generated.

Returns:
The name of the proxy class that will be generated.

getClassType

protected JClassType getClassType()
Returns the parent type.

Returns:
The parent type.

getContext

protected GeneratorContext getContext()
Returns the context object that provides metadata to defered binding generators.

Returns:
The context object that provides metadata to defered binding generators.

getLogger

protected TreeLogger getLogger()
Returns the logger used by the deferred binding generator.

Returns:
The logger used by the deferred binding generator.

getPackageName

protected String getPackageName()
Returns the package name of the parent type.

Returns:
The package name of the parent type.

getSourceWriter

protected com.google.gwt.user.rebind.SourceWriter getSourceWriter()
Returns the writer used for the content of the proxy class.

Returns:
The writer used for the content of the proxy class.

getSto

protected com.google.gwt.user.rebind.rpc.SerializableTypeOracle getSto()
Returns the serializer class.

Returns:
The serializer class.

getStob

protected com.google.gwt.user.rebind.rpc.SerializableTypeOracleBuilder getStob()
Returns the builder of the serializer class.

Returns:
The builder of the serializer class.

getTypeOracle

protected TypeOracle getTypeOracle()
Returns the type oracle for the current generator context.

Returns:
The type oracle for the current generator context.

getTypeQName

protected String getTypeQName()
Returns the parent type for which a default constructible subclass will be generated.

Returns:
The parent type for which a default constructible subclass will be generated.

indent

protected void indent()
Increments the indentation of the generated source code.


outdent

protected void outdent()
Decrements the indentation of the generated source code.


print

protected void print(String value)
Prints the given value in the generated source code.

Parameters:
value - The value to write.

println

protected void println()
Terminates the current line with a new line separator.


println

protected void println(String value)
Prints the given value in the generated source code and terminates the current line with a new line separator.

Parameters:
value - The value to write.


Copyright © 2005-2013 Restlet S.A.S..