Class State
- java.lang.Object
-
- com.google.web.bindery.requestfactory.apt.State
-
- Direct Known Subclasses:
State.ForTesting
class State extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
State.ForTesting
Slightly tweaked implementation used when running tests.
-
Field Summary
Fields Modifier and Type Field Description (package private) javax.lang.model.type.TypeMirror
baseProxyType
(package private) javax.lang.model.util.Elements
elements
(package private) javax.lang.model.type.DeclaredType
entityProxyIdType
(package private) javax.lang.model.type.DeclaredType
entityProxyType
(package private) javax.lang.model.type.DeclaredType
extraTypesAnnotation
(package private) javax.annotation.processing.Filer
filer
(package private) javax.lang.model.type.DeclaredType
instanceRequestType
(package private) javax.lang.model.type.DeclaredType
locatorType
(package private) javax.lang.model.type.DeclaredType
objectType
(package private) javax.lang.model.type.DeclaredType
requestContextType
(package private) javax.lang.model.type.DeclaredType
requestFactoryType
(package private) javax.lang.model.type.DeclaredType
requestType
(package private) java.util.Set<javax.lang.model.element.TypeElement>
seen
(package private) javax.lang.model.type.DeclaredType
serviceLocatorType
(package private) javax.lang.model.util.Types
types
(package private) javax.lang.model.type.DeclaredType
valueProxyType
-
Constructor Summary
Constructors Constructor Description State(javax.annotation.processing.ProcessingEnvironment processingEnv)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMapping(javax.lang.model.element.ExecutableElement clientMethod, javax.lang.model.element.ExecutableElement domainMethod)
Add a mapping from a client method to a domain method.void
addMapping(javax.lang.model.element.TypeElement clientType, javax.lang.model.element.TypeElement domainType)
Add a mapping from a client type to a domain type.void
checkExtraTypes(javax.lang.model.element.Element x)
Check an element for anExtraTypes
annotation.void
debug(javax.lang.model.element.Element elt, java.lang.String message, java.lang.Object... args)
Print a warning message if verbose mode is enabled.void
executeJobs()
javax.lang.model.type.DeclaredType
findType(java.lang.Class<?> clazz)
Utility method to look up raw types from class literals.java.util.Map<javax.lang.model.element.Element,javax.lang.model.element.Element>
getClientToDomainMap()
Returns a map of client elements to their domain counterparts.boolean
isClientOnly()
boolean
isMappingRequired(javax.lang.model.element.TypeElement element)
boolean
isPoisoned()
boolean
isTransportableType(javax.lang.model.type.TypeMirror asType)
Verifies that the given type may be used with RequestFactory.void
maybeScanContext(javax.lang.model.element.TypeElement requestContext)
void
maybeScanFactory(javax.lang.model.element.TypeElement factoryType)
void
maybeScanProxy(javax.lang.model.element.TypeElement proxyType)
boolean
mustResolveAllAnnotations()
void
poison(javax.lang.model.element.Element elt, java.lang.String message)
Emits a fatal error message attached to an element.void
requireMapping(javax.lang.model.element.TypeElement interfaceElement)
(package private) boolean
respectAnnotations()
This switch allows the RfValidatorTest code to be worked on in the IDE without causing compilation failures.void
setClientOnly(boolean clientOnly)
Set totrue
to indicate that only JVM-client support code needs to be generated.void
setMustResolveAllMappings(boolean requireAllMappings)
Set totrue
if it is an error for unresolved ProxyForName and ServiceName annotations to be left over.(package private) static javax.lang.model.type.TypeMirror
viewAs(javax.lang.model.type.DeclaredType desiredType, javax.lang.model.type.TypeMirror searchFrom, State state)
Used to take aFooRequest extends Request<Foo>
and find theRequest<Foo>
type.void
warn(javax.lang.model.element.Element elt, java.lang.String message)
Emits a warning message, unless the element or an enclosing element are annotated with a@SuppressWarnings("requestfactory")
.
-
-
-
Field Detail
-
baseProxyType
final javax.lang.model.type.TypeMirror baseProxyType
-
elements
final javax.lang.model.util.Elements elements
-
entityProxyIdType
final javax.lang.model.type.DeclaredType entityProxyIdType
-
entityProxyType
final javax.lang.model.type.DeclaredType entityProxyType
-
extraTypesAnnotation
final javax.lang.model.type.DeclaredType extraTypesAnnotation
-
filer
final javax.annotation.processing.Filer filer
-
instanceRequestType
final javax.lang.model.type.DeclaredType instanceRequestType
-
locatorType
final javax.lang.model.type.DeclaredType locatorType
-
objectType
final javax.lang.model.type.DeclaredType objectType
-
requestContextType
final javax.lang.model.type.DeclaredType requestContextType
-
requestFactoryType
final javax.lang.model.type.DeclaredType requestFactoryType
-
requestType
final javax.lang.model.type.DeclaredType requestType
-
serviceLocatorType
final javax.lang.model.type.DeclaredType serviceLocatorType
-
seen
final java.util.Set<javax.lang.model.element.TypeElement> seen
-
types
final javax.lang.model.util.Types types
-
valueProxyType
final javax.lang.model.type.DeclaredType valueProxyType
-
-
Method Detail
-
viewAs
static javax.lang.model.type.TypeMirror viewAs(javax.lang.model.type.DeclaredType desiredType, javax.lang.model.type.TypeMirror searchFrom, State state)
Used to take aFooRequest extends Request<Foo>
and find theRequest<Foo>
type.
-
addMapping
public void addMapping(javax.lang.model.element.ExecutableElement clientMethod, javax.lang.model.element.ExecutableElement domainMethod)
Add a mapping from a client method to a domain method.
-
addMapping
public void addMapping(javax.lang.model.element.TypeElement clientType, javax.lang.model.element.TypeElement domainType)
Add a mapping from a client type to a domain type.
-
checkExtraTypes
public void checkExtraTypes(javax.lang.model.element.Element x)
Check an element for anExtraTypes
annotation. Handles both methods and types.
-
debug
public void debug(javax.lang.model.element.Element elt, java.lang.String message, java.lang.Object... args)
Print a warning message if verbose mode is enabled. A warning is used to ensure that the message shows up in Eclipse's editor (a note only makes it into the error console).
-
executeJobs
public void executeJobs()
-
findType
public javax.lang.model.type.DeclaredType findType(java.lang.Class<?> clazz)
Utility method to look up raw types from class literals.
-
getClientToDomainMap
public java.util.Map<javax.lang.model.element.Element,javax.lang.model.element.Element> getClientToDomainMap()
Returns a map of client elements to their domain counterparts. The keys may be RequestContext or Proxy types or methods within those types.
-
isClientOnly
public boolean isClientOnly()
-
isMappingRequired
public boolean isMappingRequired(javax.lang.model.element.TypeElement element)
-
isPoisoned
public boolean isPoisoned()
-
isTransportableType
public boolean isTransportableType(javax.lang.model.type.TypeMirror asType)
Verifies that the given type may be used with RequestFactory.- See Also:
TransportableTypeVisitor
-
maybeScanContext
public void maybeScanContext(javax.lang.model.element.TypeElement requestContext)
-
maybeScanFactory
public void maybeScanFactory(javax.lang.model.element.TypeElement factoryType)
-
maybeScanProxy
public void maybeScanProxy(javax.lang.model.element.TypeElement proxyType)
-
mustResolveAllAnnotations
public boolean mustResolveAllAnnotations()
-
poison
public void poison(javax.lang.model.element.Element elt, java.lang.String message)
Emits a fatal error message attached to an element. If the element or an eclosing type is annotated withSkipInterfaceValidation
the message will be dropped.
-
requireMapping
public void requireMapping(javax.lang.model.element.TypeElement interfaceElement)
-
setClientOnly
public void setClientOnly(boolean clientOnly)
Set totrue
to indicate that only JVM-client support code needs to be generated.
-
setMustResolveAllMappings
public void setMustResolveAllMappings(boolean requireAllMappings)
Set totrue
if it is an error for unresolved ProxyForName and ServiceName annotations to be left over.
-
warn
public void warn(javax.lang.model.element.Element elt, java.lang.String message)
Emits a warning message, unless the element or an enclosing element are annotated with a@SuppressWarnings("requestfactory")
.
-
respectAnnotations
boolean respectAnnotations()
This switch allows the RfValidatorTest code to be worked on in the IDE without causing compilation failures.
-
-