org.cruxframework.crux.core.rebind.rest
Class CruxRestProxyCreator

java.lang.Object
  extended by org.cruxframework.crux.core.rebind.AbstractProxyCreator
      extended by org.cruxframework.crux.core.rebind.AbstractInterfaceWrapperProxyCreator
          extended by org.cruxframework.crux.core.rebind.rest.CruxRestProxyCreator
Direct Known Subclasses:
CruxRestProxyCreatorFromClientMetadata, CruxRestProxyCreatorFromServerMetadata

public abstract class CruxRestProxyCreator
extends AbstractInterfaceWrapperProxyCreator

This class creates a client proxy for calling rest services

Author:
Thiago da Rosa de Bustamante

Nested Class Summary
 
Nested classes/interfaces inherited from class org.cruxframework.crux.core.rebind.AbstractProxyCreator
AbstractProxyCreator.SourcePrinter
 
Field Summary
protected  org.cruxframework.crux.core.rebind.rest.BodyParameterHandler bodyParameterHandler
           
protected  com.google.gwt.core.ext.typeinfo.JClassType callbackType
           
protected  com.google.gwt.core.ext.typeinfo.JClassType javascriptObjectType
           
protected  String jsonPCallbackParam
           
protected  String jsonPFailureCallbackParam
           
protected  JsonPRestCreatorHelper jsonPRestCreatorHelper
           
protected  boolean mustGenerateStateControlMethods
           
protected  org.cruxframework.crux.core.rebind.rest.QueryParameterHandler queryParameterHandler
           
protected  Set<String> readMethods
           
protected  Set<org.cruxframework.crux.core.rebind.rest.RestMethodInfo> restMethods
           
protected  com.google.gwt.core.ext.typeinfo.JClassType restProxyType
           
protected  String serviceBasePath
           
protected  Set<String> updateMethods
           
protected  boolean useJsonP
           
 
Fields inherited from class org.cruxframework.crux.core.rebind.AbstractInterfaceWrapperProxyCreator
baseIntf
 
Fields inherited from class org.cruxframework.crux.core.rebind.AbstractProxyCreator
cacheable, cacheableVersionFound, context, logger
 
Constructor Summary
CruxRestProxyCreator(com.google.gwt.core.ext.TreeLogger logger, com.google.gwt.core.ext.GeneratorContext context, com.google.gwt.core.ext.typeinfo.JClassType baseIntf)
           
 
Method Summary
protected  void generateAJAXInvocation(org.cruxframework.crux.core.rebind.rest.RestMethodInfo methodInfo, AbstractProxyCreator.SourcePrinter srcWriter, com.google.gwt.core.ext.typeinfo.JParameter callbackParameter, String callbackResultTypeName, String callbackParameterName, String restURIParam)
           
protected  void generateExceptionCallHandlingCode(org.cruxframework.crux.core.rebind.rest.RestMethodInfo methodInfo, AbstractProxyCreator.SourcePrinter srcWriter, String callbackParameterName, String responseVariable)
           
protected abstract  void generateHostPathInitialization(AbstractProxyCreator.SourcePrinter srcWriter)
           
protected  void generateProxyContructor(AbstractProxyCreator.SourcePrinter srcWriter)
          Generate the proxy constructor and delegate to the superclass constructor using the default address for the RemoteService.
protected  void generateProxyFields(AbstractProxyCreator.SourcePrinter srcWriter)
          Generate any fields required by the proxy.
protected  void generateProxyMethods(AbstractProxyCreator.SourcePrinter srcWriter)
           
protected  void generateSaveStateBlock(AbstractProxyCreator.SourcePrinter srcWriter, boolean isReadMethod, String responseVar, String uriVar, String uri)
           
protected  void generateSetEndpointMethod(AbstractProxyCreator.SourcePrinter srcWriter)
           
protected  void generateStateControlMethods(AbstractProxyCreator.SourcePrinter srcWriter)
           
protected  void generateSuccessCallHandlingCode(org.cruxframework.crux.core.rebind.rest.RestMethodInfo methodInfo, AbstractProxyCreator.SourcePrinter srcWriter, com.google.gwt.core.ext.typeinfo.JParameter callbackParameter, String callbackResultTypeName, String callbackParameterName, String restURIParam)
           
protected  void generateValidateStateBlock(AbstractProxyCreator.SourcePrinter srcWriter, StateValidationModel validationModel, String builderVar, String uriVar, String uri, String callbackParameterName)
           
protected  void generateViewBindableMethods(AbstractProxyCreator.SourcePrinter sourceWriter)
           
protected  void generateWrapperMethod(org.cruxframework.crux.core.rebind.rest.RestMethodInfo methodInfo, AbstractProxyCreator.SourcePrinter srcWriter)
           
protected  void generateXSRFHeaderProtectionForWrites(String httpMethod, String builderVar, AbstractProxyCreator.SourcePrinter srcWriter)
           
protected  String getCallbackResultTypeName(com.google.gwt.core.ext.typeinfo.JClassType callbackParameter)
           
protected  String[] getImports()
           
protected abstract  org.cruxframework.crux.core.rebind.rest.RestMethodInfo getRestMethodInfo(com.google.gwt.core.ext.typeinfo.JMethod method)
           
protected  String getRestURI(com.google.gwt.core.ext.typeinfo.JMethod method, Annotation[][] parameterAnnotations, Path path)
           
protected abstract  String getServiceBasePath(com.google.gwt.core.ext.GeneratorContext context)
           
protected  void initializeRestMethods()
           
protected  String paths(String basePath, String... segments)
           
protected  void setLocaleInfo(AbstractProxyCreator.SourcePrinter srcWriter, String builderVariable)
           
protected  void validateProxyMethod(com.google.gwt.core.ext.typeinfo.JMethod method)
           
 
Methods inherited from class org.cruxframework.crux.core.rebind.AbstractInterfaceWrapperProxyCreator
findCacheableImplementationAndMarkForReuseIfAvailable, getDeviceFeatures, getModule, getProxyQualifiedName, getProxySimpleName, getScreens, getSourcePrinter, getUserAgent, getViews
 
Methods inherited from class org.cruxframework.crux.core.rebind.AbstractProxyCreator
cacheableVersionFound, create, findCacheableImplementationAndMarkForReuseIfAvailable, generateLoggerField, generateMethodParameters, generateMethodTrhowsClause, generateProxyWrapperMethodDeclaration, generateSubTypes, getJsniSimpleSignature, isAlreadyGenerated, isCacheable, isCrux2OldInterfacesCompatibilityEnabled, logDebugMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

callbackType

protected com.google.gwt.core.ext.typeinfo.JClassType callbackType

javascriptObjectType

protected com.google.gwt.core.ext.typeinfo.JClassType javascriptObjectType

serviceBasePath

protected String serviceBasePath

readMethods

protected Set<String> readMethods

updateMethods

protected Set<String> updateMethods

restMethods

protected Set<org.cruxframework.crux.core.rebind.rest.RestMethodInfo> restMethods

mustGenerateStateControlMethods

protected boolean mustGenerateStateControlMethods

queryParameterHandler

protected org.cruxframework.crux.core.rebind.rest.QueryParameterHandler queryParameterHandler

bodyParameterHandler

protected org.cruxframework.crux.core.rebind.rest.BodyParameterHandler bodyParameterHandler

restProxyType

protected com.google.gwt.core.ext.typeinfo.JClassType restProxyType

useJsonP

protected boolean useJsonP

jsonPCallbackParam

protected String jsonPCallbackParam

jsonPFailureCallbackParam

protected String jsonPFailureCallbackParam

jsonPRestCreatorHelper

protected JsonPRestCreatorHelper jsonPRestCreatorHelper
Constructor Detail

CruxRestProxyCreator

public CruxRestProxyCreator(com.google.gwt.core.ext.TreeLogger logger,
                            com.google.gwt.core.ext.GeneratorContext context,
                            com.google.gwt.core.ext.typeinfo.JClassType baseIntf)
Method Detail

getServiceBasePath

protected abstract String getServiceBasePath(com.google.gwt.core.ext.GeneratorContext context)

generateHostPathInitialization

protected abstract void generateHostPathInitialization(AbstractProxyCreator.SourcePrinter srcWriter)

getRestMethodInfo

protected abstract org.cruxframework.crux.core.rebind.rest.RestMethodInfo getRestMethodInfo(com.google.gwt.core.ext.typeinfo.JMethod method)
                                                                                     throws InvalidRestMethod
Throws:
InvalidRestMethod

generateProxyContructor

protected void generateProxyContructor(AbstractProxyCreator.SourcePrinter srcWriter)
                                throws CruxGeneratorException
Description copied from class: AbstractProxyCreator
Generate the proxy constructor and delegate to the superclass constructor using the default address for the RemoteService.

Overrides:
generateProxyContructor in class AbstractProxyCreator
Throws:
CruxGeneratorException

generateProxyFields

protected void generateProxyFields(AbstractProxyCreator.SourcePrinter srcWriter)
                            throws CruxGeneratorException
Description copied from class: AbstractProxyCreator
Generate any fields required by the proxy.

Overrides:
generateProxyFields in class AbstractProxyCreator
Throws:
CruxGeneratorException

generateProxyMethods

protected void generateProxyMethods(AbstractProxyCreator.SourcePrinter srcWriter)
                             throws CruxGeneratorException
Overrides:
generateProxyMethods in class AbstractProxyCreator
Throws:
CruxGeneratorException

generateViewBindableMethods

protected void generateViewBindableMethods(AbstractProxyCreator.SourcePrinter sourceWriter)

generateSetEndpointMethod

protected void generateSetEndpointMethod(AbstractProxyCreator.SourcePrinter srcWriter)

generateStateControlMethods

protected void generateStateControlMethods(AbstractProxyCreator.SourcePrinter srcWriter)

initializeRestMethods

protected void initializeRestMethods()

generateWrapperMethod

protected void generateWrapperMethod(org.cruxframework.crux.core.rebind.rest.RestMethodInfo methodInfo,
                                     AbstractProxyCreator.SourcePrinter srcWriter)

generateAJAXInvocation

protected void generateAJAXInvocation(org.cruxframework.crux.core.rebind.rest.RestMethodInfo methodInfo,
                                      AbstractProxyCreator.SourcePrinter srcWriter,
                                      com.google.gwt.core.ext.typeinfo.JParameter callbackParameter,
                                      String callbackResultTypeName,
                                      String callbackParameterName,
                                      String restURIParam)

generateExceptionCallHandlingCode

protected void generateExceptionCallHandlingCode(org.cruxframework.crux.core.rebind.rest.RestMethodInfo methodInfo,
                                                 AbstractProxyCreator.SourcePrinter srcWriter,
                                                 String callbackParameterName,
                                                 String responseVariable)

generateSuccessCallHandlingCode

protected void generateSuccessCallHandlingCode(org.cruxframework.crux.core.rebind.rest.RestMethodInfo methodInfo,
                                               AbstractProxyCreator.SourcePrinter srcWriter,
                                               com.google.gwt.core.ext.typeinfo.JParameter callbackParameter,
                                               String callbackResultTypeName,
                                               String callbackParameterName,
                                               String restURIParam)

setLocaleInfo

protected void setLocaleInfo(AbstractProxyCreator.SourcePrinter srcWriter,
                             String builderVariable)

generateXSRFHeaderProtectionForWrites

protected void generateXSRFHeaderProtectionForWrites(String httpMethod,
                                                     String builderVar,
                                                     AbstractProxyCreator.SourcePrinter srcWriter)

generateSaveStateBlock

protected void generateSaveStateBlock(AbstractProxyCreator.SourcePrinter srcWriter,
                                      boolean isReadMethod,
                                      String responseVar,
                                      String uriVar,
                                      String uri)

generateValidateStateBlock

protected void generateValidateStateBlock(AbstractProxyCreator.SourcePrinter srcWriter,
                                          StateValidationModel validationModel,
                                          String builderVar,
                                          String uriVar,
                                          String uri,
                                          String callbackParameterName)

getCallbackResultTypeName

protected String getCallbackResultTypeName(com.google.gwt.core.ext.typeinfo.JClassType callbackParameter)

getRestURI

protected String getRestURI(com.google.gwt.core.ext.typeinfo.JMethod method,
                            Annotation[][] parameterAnnotations,
                            Path path)

paths

protected String paths(String basePath,
                       String... segments)

getImports

protected String[] getImports()
Specified by:
getImports in class AbstractInterfaceWrapperProxyCreator
Returns:
the list of imports required by proxy

validateProxyMethod

protected void validateProxyMethod(com.google.gwt.core.ext.typeinfo.JMethod method)


Copyright © 2014. All rights reserved.