Mass auto-format of RequestFactory code before landing a big patch.
Patch by: bobv
Review by: rjrjr
Review at http://gwt-code-reviews.appspot.com/1450811
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@10271 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/web/bindery/requestfactory/gwt/client/DefaultRequestTransport.java b/user/src/com/google/web/bindery/requestfactory/gwt/client/DefaultRequestTransport.java
index 12203a2..fd57778 100644
--- a/user/src/com/google/web/bindery/requestfactory/gwt/client/DefaultRequestTransport.java
+++ b/user/src/com/google/web/bindery/requestfactory/gwt/client/DefaultRequestTransport.java
@@ -76,8 +76,7 @@
wireLogger.finest("Sending fire request");
builder.send();
} catch (RequestException e) {
- wireLogger.log(Level.SEVERE, SERVER_ERROR + " (" + e.getMessage() + ")",
- e);
+ wireLogger.log(Level.SEVERE, SERVER_ERROR + " (" + e.getMessage() + ")", e);
}
}
@@ -117,11 +116,12 @@
* {@link com.google.web.bindery.requestfactory.shared.RequestTransport.TransportReceiver
* TransportReceiver} interface.
*
- * @param receiver a {@link com.google.web.bindery.requestfactory.shared.RequestTransport.TransportReceiver TransportReceiver}
+ * @param receiver a
+ * {@link com.google.web.bindery.requestfactory.shared.RequestTransport.TransportReceiver
+ * TransportReceiver}
* @return a {@link RequestCallback} instance
*/
- protected RequestCallback createRequestCallback(
- final TransportReceiver receiver) {
+ protected RequestCallback createRequestCallback(final TransportReceiver receiver) {
return new RequestCallback() {
public void onError(Request request, Throwable exception) {
@@ -135,8 +135,7 @@
String text = response.getText();
receiver.onTransportSuccess(text);
} else {
- String message = SERVER_ERROR + " " + response.getStatusCode() + " "
- + response.getText();
+ String message = SERVER_ERROR + " " + response.getStatusCode() + " " + response.getText();
wireLogger.severe(message);
receiver.onTransportFailure(new ServerFailure(message));
}
diff --git a/user/src/com/google/web/bindery/requestfactory/gwt/client/RequestFactoryLogHandler.java b/user/src/com/google/web/bindery/requestfactory/gwt/client/RequestFactoryLogHandler.java
index 47d67a8..32f5525 100644
--- a/user/src/com/google/web/bindery/requestfactory/gwt/client/RequestFactoryLogHandler.java
+++ b/user/src/com/google/web/bindery/requestfactory/gwt/client/RequestFactoryLogHandler.java
@@ -36,7 +36,7 @@
public static interface LoggingRequestProvider {
/**
* Returns the logging request.
- *
+ *
* @return a {@link LoggingRequest} instance
*/
LoggingRequest getLoggingRequest();
@@ -45,20 +45,20 @@
private LoggingRequestProvider requestProvider;
/**
- * Since records from this handler go accross the wire, it should only be
- * used for important messages, and it's Level will often be higher than the
- * Level being used app-wide. This handler also takes string which it will
- * use to exclude the messages from some loggers. This usually includes the
- * name of the logger(s) which will be used to log acknowledgements of
- * activity going accross the wire. If we did not exclude these loggers, an
- * infinite loop would occur.
- *
+ * Since records from this handler go accross the wire, it should only be used
+ * for important messages, and it's Level will often be higher than the Level
+ * being used app-wide. This handler also takes string which it will use to
+ * exclude the messages from some loggers. This usually includes the name of
+ * the logger(s) which will be used to log acknowledgements of activity going
+ * accross the wire. If we did not exclude these loggers, an infinite loop
+ * would occur.
+ *
* @param requestProvider a {@link LoggingRequestProvider} instance
* @param level a logging {@link Level}
* @param ignoredLoggerNames a List of Strings
*/
- public RequestFactoryLogHandler(LoggingRequestProvider requestProvider,
- Level level, List<String> ignoredLoggerNames) {
+ public RequestFactoryLogHandler(LoggingRequestProvider requestProvider, Level level,
+ List<String> ignoredLoggerNames) {
super(ignoredLoggerNames);
this.requestProvider = requestProvider;
setLevel(level);
@@ -70,12 +70,11 @@
return;
}
String json = JsonLogRecordClientUtil.logRecordAsJson(record);
- requestProvider.getLoggingRequest().logMessage(json).fire(
- new Receiver<Void>() {
- @Override
- public void onSuccess(Void response) {
- // Do nothing
- }
- });
+ requestProvider.getLoggingRequest().logMessage(json).fire(new Receiver<Void>() {
+ @Override
+ public void onSuccess(Void response) {
+ // Do nothing
+ }
+ });
}
}
diff --git a/user/src/com/google/web/bindery/requestfactory/gwt/client/package-info.java b/user/src/com/google/web/bindery/requestfactory/gwt/client/package-info.java
index 6413a73..6695653 100644
--- a/user/src/com/google/web/bindery/requestfactory/gwt/client/package-info.java
+++ b/user/src/com/google/web/bindery/requestfactory/gwt/client/package-info.java
@@ -16,8 +16,9 @@
/**
* A package for managing client-server requests.
- *
+ *
* @since GWT 2.1
*/
@com.google.gwt.util.PreventSpuriousRebuilds
package com.google.web.bindery.requestfactory.gwt.client;
+
diff --git a/user/src/com/google/web/bindery/requestfactory/gwt/rebind/RequestFactoryEditorDriverGenerator.java b/user/src/com/google/web/bindery/requestfactory/gwt/rebind/RequestFactoryEditorDriverGenerator.java
index 347c576..f3255d8 100644
--- a/user/src/com/google/web/bindery/requestfactory/gwt/rebind/RequestFactoryEditorDriverGenerator.java
+++ b/user/src/com/google/web/bindery/requestfactory/gwt/rebind/RequestFactoryEditorDriverGenerator.java
@@ -29,16 +29,14 @@
/**
* Generates implementations of RFEDs.
*/
-public class RequestFactoryEditorDriverGenerator extends
- AbstractEditorDriverGenerator {
+public class RequestFactoryEditorDriverGenerator extends AbstractEditorDriverGenerator {
private JClassType baseProxyType;
@Override
- public String generate(TreeLogger logger, GeneratorContext context,
- String typeName) throws UnableToCompleteException {
- baseProxyType = context.getTypeOracle().findType(
- BaseProxy.class.getCanonicalName());
+ public String generate(TreeLogger logger, GeneratorContext context, String typeName)
+ throws UnableToCompleteException {
+ baseProxyType = context.getTypeOracle().findType(BaseProxy.class.getCanonicalName());
return super.generate(logger, context, typeName);
}
@@ -58,12 +56,10 @@
}
@Override
- protected String mutableObjectExpression(EditorData data,
- String sourceObjectExpression) {
+ protected String mutableObjectExpression(EditorData data, String sourceObjectExpression) {
if (baseProxyType.isAssignableFrom(data.getPropertyOwnerType())) {
- return String.format("((%s) request.edit((%s)))",
- data.getPropertyOwnerType().getQualifiedSourceName(),
- sourceObjectExpression);
+ return String.format("((%s) request.edit((%s)))", data.getPropertyOwnerType()
+ .getQualifiedSourceName(), sourceObjectExpression);
} else {
return sourceObjectExpression;
}
diff --git a/user/src/com/google/web/bindery/requestfactory/gwt/rebind/RequestFactoryGenerator.java b/user/src/com/google/web/bindery/requestfactory/gwt/rebind/RequestFactoryGenerator.java
index e6d7f5c..35c9821 100644
--- a/user/src/com/google/web/bindery/requestfactory/gwt/rebind/RequestFactoryGenerator.java
+++ b/user/src/com/google/web/bindery/requestfactory/gwt/rebind/RequestFactoryGenerator.java
@@ -67,16 +67,15 @@
/**
* Generates implementations of
- * {@link com.google.web.bindery.requestfactory.shared.RequestFactory RequestFactory}
- * and its nested interfaces.
+ * {@link com.google.web.bindery.requestfactory.shared.RequestFactory
+ * RequestFactory} and its nested interfaces.
*/
public class RequestFactoryGenerator extends Generator {
/**
* Visits all types reachable from a RequestContext.
*/
- private static class AllReachableTypesVisitor extends
- RequestMethodTypesVisitor {
+ private static class AllReachableTypesVisitor extends RequestMethodTypesVisitor {
private final RequestFactoryModel model;
public AllReachableTypesVisitor(RequestFactoryModel model) {
@@ -144,8 +143,8 @@
private RequestFactoryModel model;
@Override
- public String generate(TreeLogger logger, GeneratorContext context,
- String typeName) throws UnableToCompleteException {
+ public String generate(TreeLogger logger, GeneratorContext context, String typeName)
+ throws UnableToCompleteException {
this.context = context;
this.logger = logger;
@@ -165,8 +164,8 @@
model = new RequestFactoryModel(logger, toGenerate);
- ClassSourceFileComposerFactory factory = new ClassSourceFileComposerFactory(
- packageName, simpleSourceName);
+ ClassSourceFileComposerFactory factory =
+ new ClassSourceFileComposerFactory(packageName, simpleSourceName);
factory.setSuperclass(AbstractClientRequestFactory.class.getCanonicalName());
factory.addImplementedInterface(typeName);
SourceWriter sw = factory.createSourceWriter(context, pw);
@@ -240,8 +239,8 @@
return models;
}
- private void writeAutoBeanFactory(SourceWriter sw,
- Collection<EntityProxyModel> models, Collection<JEnumType> extraEnums) {
+ private void writeAutoBeanFactory(SourceWriter sw, Collection<EntityProxyModel> models,
+ Collection<JEnumType> extraEnums) {
if (!extraEnums.isEmpty()) {
StringBuilder extraClasses = new StringBuilder();
for (JEnumType enumType : extraEnums) {
@@ -253,22 +252,18 @@
sw.println("@%s({%s})", ExtraEnums.class.getCanonicalName(), extraClasses);
}
// Map in static implementations of EntityProxy methods
- sw.println("@%s({%s.class, %s.class, %s.class})",
- Category.class.getCanonicalName(),
- EntityProxyCategory.class.getCanonicalName(),
- ValueProxyCategory.class.getCanonicalName(),
+ sw.println("@%s({%s.class, %s.class, %s.class})", Category.class.getCanonicalName(),
+ EntityProxyCategory.class.getCanonicalName(), ValueProxyCategory.class.getCanonicalName(),
BaseProxyCategory.class.getCanonicalName());
// Don't wrap our id type, because it makes code grungy
- sw.println("@%s(%s.class)", NoWrap.class.getCanonicalName(),
- EntityProxyId.class.getCanonicalName());
- sw.println("interface Factory extends %s {",
- AutoBeanFactory.class.getCanonicalName());
+ sw.println("@%s(%s.class)", NoWrap.class.getCanonicalName(), EntityProxyId.class
+ .getCanonicalName());
+ sw.println("interface Factory extends %s {", AutoBeanFactory.class.getCanonicalName());
sw.indent();
for (EntityProxyModel proxy : models) {
// AutoBean<FooProxy> com_google_FooProxy();
- sw.println("%s<%s> %s();", AutoBean.class.getCanonicalName(),
- proxy.getQualifiedSourceName(),
+ sw.println("%s<%s> %s();", AutoBean.class.getCanonicalName(), proxy.getQualifiedSourceName(),
proxy.getQualifiedSourceName().replace('.', '_'));
}
sw.outdent();
@@ -281,8 +276,7 @@
sw.println("@Override public Factory getAutoBeanFactory() {");
sw.indent();
sw.println("if (FACTORY == null) {");
- sw.indentln("FACTORY = %s.create(Factory.class);",
- GWT.class.getCanonicalName());
+ sw.indentln("FACTORY = %s.create(Factory.class);", GWT.class.getCanonicalName());
sw.println("}");
sw.println("return FACTORY;");
sw.outdent();
@@ -291,25 +285,23 @@
private void writeContextImplementations() {
for (ContextMethod method : model.getMethods()) {
- PrintWriter pw = context.tryCreate(logger, method.getPackageName(),
- method.getSimpleSourceName());
+ PrintWriter pw =
+ context.tryCreate(logger, method.getPackageName(), method.getSimpleSourceName());
if (pw == null) {
// Already generated
continue;
}
- ClassSourceFileComposerFactory factory = new ClassSourceFileComposerFactory(
- method.getPackageName(), method.getSimpleSourceName());
+ ClassSourceFileComposerFactory factory =
+ new ClassSourceFileComposerFactory(method.getPackageName(), method.getSimpleSourceName());
factory.setSuperclass(AbstractRequestContext.class.getCanonicalName());
factory.addImplementedInterface(method.getImplementedInterfaceQualifiedSourceName());
SourceWriter sw = factory.createSourceWriter(context, pw);
// Constructor that accepts the parent RequestFactory
- sw.println(
- "public %s(%s requestFactory) {super(requestFactory, %s.%s);}",
- method.getSimpleSourceName(),
- AbstractRequestFactory.class.getCanonicalName(),
- Dialect.class.getCanonicalName(), method.getDialect().name());
+ sw.println("public %s(%s requestFactory) {super(requestFactory, %s.%s);}", method
+ .getSimpleSourceName(), AbstractRequestFactory.class.getCanonicalName(), Dialect.class
+ .getCanonicalName(), method.getDialect().name());
Set<EntityProxyModel> models = findReferencedEntities(method);
Set<JEnumType> extraEnumTypes = findExtraEnums(method);
@@ -332,8 +324,7 @@
parameterArray.append(",null");
}
for (JTypeParameter param : jmethod.getTypeParameters()) {
- typeParameterDeclaration.append(",").append(
- param.getQualifiedSourceName());
+ typeParameterDeclaration.append(",").append(param.getQualifiedSourceName());
}
for (JParameter param : jmethod.getParameters()) {
parameterArray.append(",").append(param.getName());
@@ -352,38 +343,35 @@
}
// public Request<Foo> doFoo(final Foo foo) {
- sw.println("public %s %s %s(%s) {", typeParameterDeclaration,
- jmethod.getReturnType().getParameterizedQualifiedSourceName(),
- jmethod.getName(), parameterDeclaration);
+ sw.println("public %s %s %s(%s) {", typeParameterDeclaration, jmethod.getReturnType()
+ .getParameterizedQualifiedSourceName(), jmethod.getName(), parameterDeclaration);
sw.indent();
// The implements clause covers InstanceRequest
// class X extends AbstractRequest<Return> implements Request<Return> {
- sw.println("class X extends %s<%s> implements %s {",
- AbstractRequest.class.getCanonicalName(),
- request.getDataType().getParameterizedQualifiedSourceName(),
+ sw.println("class X extends %s<%s> implements %s {", AbstractRequest.class
+ .getCanonicalName(), request.getDataType().getParameterizedQualifiedSourceName(),
jmethod.getReturnType().getParameterizedQualifiedSourceName());
sw.indent();
// public X() { super(FooRequestContext.this); }
- sw.println("public X() { super(%s.this);}",
- method.getSimpleSourceName());
+ sw.println("public X() { super(%s.this);}", method.getSimpleSourceName());
// This could also be gotten rid of by having only Request /
// InstanceRequest
sw.println("@Override public X with(String... paths) {super.with(paths); return this;}");
// makeRequestData()
- sw.println("@Override protected %s makeRequestData() {",
- RequestData.class.getCanonicalName());
+ sw.println("@Override protected %s makeRequestData() {", RequestData.class
+ .getCanonicalName());
// return new RequestData("Foo::bar", {parameters}, propertyRefs,
// List.class, FooProxy.class);
- String elementType = request.isCollectionType()
- ? request.getCollectionElementType().getQualifiedSourceName()
+ String elementType =
+ request.isCollectionType() ? request.getCollectionElementType()
+ .getQualifiedSourceName()
+ ".class" : "null";
- String returnTypeBaseQualifiedName = ModelUtils.ensureBaseType(
- request.getDataType()).getQualifiedSourceName();
- sw.indentln(
- "return new %s(\"%s\", new Object[] {%s}, propertyRefs, %s.class, %s);",
+ String returnTypeBaseQualifiedName =
+ ModelUtils.ensureBaseType(request.getDataType()).getQualifiedSourceName();
+ sw.indentln("return new %s(\"%s\", new Object[] {%s}, propertyRefs, %s.class, %s);",
RequestData.class.getCanonicalName(), operation, parameterArray,
returnTypeBaseQualifiedName, elementType);
sw.println("}");
@@ -395,15 +383,13 @@
if (method.getDialect().equals(Dialect.JSON_RPC)) {
for (JMethod setter : request.getExtraSetters()) {
PropertyName propertyNameAnnotation = setter.getAnnotation(PropertyName.class);
- String propertyName = propertyNameAnnotation == null
- ? JBeanMethod.SET.inferName(setter)
- : propertyNameAnnotation.value();
- String maybeReturn = JBeanMethod.SET_BUILDER.matches(setter)
- ? "return this;" : "";
- sw.println(
- "%s { getRequestData().setNamedParameter(\"%s\", %s); %s}",
- setter.getReadableDeclaration(false, false, false, false, true),
- propertyName, setter.getParameters()[0].getName(), maybeReturn);
+ String propertyName =
+ propertyNameAnnotation == null ? JBeanMethod.SET.inferName(setter)
+ : propertyNameAnnotation.value();
+ String maybeReturn = JBeanMethod.SET_BUILDER.matches(setter) ? "return this;" : "";
+ sw.println("%s { getRequestData().setNamedParameter(\"%s\", %s); %s}", setter
+ .getReadableDeclaration(false, false, false, false, true), propertyName, setter
+ .getParameters()[0].getName(), maybeReturn);
}
}
@@ -415,23 +401,21 @@
sw.println("X x = new X();");
if (request.getApiVersion() != null) {
- sw.println("x.getRequestData().setApiVersion(\"%s\");",
- Generator.escape(request.getApiVersion()));
+ sw.println("x.getRequestData().setApiVersion(\"%s\");", Generator.escape(request
+ .getApiVersion()));
}
// JSON-RPC payloads send their parameters in a by-name fashion
if (method.getDialect().equals(Dialect.JSON_RPC)) {
for (JParameter param : jmethod.getParameters()) {
PropertyName annotation = param.getAnnotation(PropertyName.class);
- String propertyName = annotation == null ? param.getName()
- : annotation.value();
+ String propertyName = annotation == null ? param.getName() : annotation.value();
boolean isContent = param.isAnnotationPresent(JsonRpcContent.class);
if (isContent) {
- sw.println("x.getRequestData().setRequestContent(%s);",
- param.getName());
+ sw.println("x.getRequestData().setRequestContent(%s);", param.getName());
} else {
- sw.println("x.getRequestData().setNamedParameter(\"%s\", %s);",
- propertyName, param.getName());
+ sw.println("x.getRequestData().setNamedParameter(\"%s\", %s);", propertyName, param
+ .getName());
}
}
}
@@ -452,8 +436,7 @@
private void writeContextMethods(SourceWriter sw) {
for (ContextMethod method : model.getMethods()) {
// public FooService foo() {
- sw.println("public %s %s() {", method.getQualifiedSourceName(),
- method.getMethodName());
+ sw.println("public %s %s() {", method.getQualifiedSourceName(), method.getMethodName());
// return new FooServiceImpl(this);
sw.indentln("return new %s(this);", method.getQualifiedSourceName());
sw.println("}");
@@ -465,25 +448,22 @@
+ " = new %1$s<String, Class<?>>();", HashMap.class.getCanonicalName());
sw.println("private static final %1$s<Class<?>, String> typesToTokens"
+ " = new %1$s<Class<?>, String>();", HashMap.class.getCanonicalName());
- sw.println(
- "private static final %1$s<Class<?>> entityProxyTypes = new %1$s<Class<?>>();",
+ sw.println("private static final %1$s<Class<?>> entityProxyTypes = new %1$s<Class<?>>();",
HashSet.class.getCanonicalName());
- sw.println(
- "private static final %1$s<Class<?>> valueProxyTypes = new %1$s<Class<?>>();",
+ sw.println("private static final %1$s<Class<?>> valueProxyTypes = new %1$s<Class<?>>();",
HashSet.class.getCanonicalName());
sw.println("static {");
sw.indent();
for (EntityProxyModel type : model.getAllProxyModels()) {
// tokensToTypes.put("Foo", Foo.class);
- sw.println("tokensToTypes.put(\"%s\", %s.class);",
- type.getQualifiedBinaryName(), type.getQualifiedSourceName());
+ sw.println("tokensToTypes.put(\"%s\", %s.class);", type.getQualifiedBinaryName(), type
+ .getQualifiedSourceName());
// typesToTokens.put(Foo.class, Foo);
- sw.println("typesToTokens.put(%s.class, \"%s\");",
- type.getQualifiedSourceName(), type.getQualifiedBinaryName());
+ sw.println("typesToTokens.put(%s.class, \"%s\");", type.getQualifiedSourceName(), type
+ .getQualifiedBinaryName());
// fooProxyTypes.add(MyFooProxy.class);
- sw.println("%s.add(%s.class);", type.getType().equals(Type.ENTITY)
- ? "entityProxyTypes" : "valueProxyTypes",
- type.getQualifiedSourceName());
+ sw.println("%s.add(%s.class);", type.getType().equals(Type.ENTITY) ? "entityProxyTypes"
+ : "valueProxyTypes", type.getQualifiedSourceName());
}
sw.outdent();
sw.println("}");
diff --git a/user/src/com/google/web/bindery/requestfactory/gwt/ui/client/EntityProxyKeyProvider.java b/user/src/com/google/web/bindery/requestfactory/gwt/ui/client/EntityProxyKeyProvider.java
index 9aa6523..cc8e271 100644
--- a/user/src/com/google/web/bindery/requestfactory/gwt/ui/client/EntityProxyKeyProvider.java
+++ b/user/src/com/google/web/bindery/requestfactory/gwt/ui/client/EntityProxyKeyProvider.java
@@ -20,8 +20,7 @@
/**
* An {@link EntityProxy}-aware key provider, handy for use with
- * {@link com.google.gwt.view.client.SelectionModel} and various
- * cell widgets.
+ * {@link com.google.gwt.view.client.SelectionModel} and various cell widgets.
*
* @see com.google.gwt.user.cellview.client.CellBrowser
* @see com.google.gwt.user.cellview.client.CellList
@@ -29,11 +28,10 @@
*
* @param <P> the proxy type
*/
-public class EntityProxyKeyProvider<P extends EntityProxy> implements
- ProvidesKey<P> {
+public class EntityProxyKeyProvider<P extends EntityProxy> implements ProvidesKey<P> {
/**
* Returns the key Object for the given item.
- *
+ *
* @param item an item of type P
*/
public Object getKey(P item) {
diff --git a/user/src/com/google/web/bindery/requestfactory/gwt/ui/client/ProxyRenderer.java b/user/src/com/google/web/bindery/requestfactory/gwt/ui/client/ProxyRenderer.java
index dd5f733..a30eb5f 100644
--- a/user/src/com/google/web/bindery/requestfactory/gwt/ui/client/ProxyRenderer.java
+++ b/user/src/com/google/web/bindery/requestfactory/gwt/ui/client/ProxyRenderer.java
@@ -23,14 +23,13 @@
*
* @param <R> the type to render
*/
-public abstract class ProxyRenderer<R> extends
- AbstractRenderer<R> {
+public abstract class ProxyRenderer<R> extends AbstractRenderer<R> {
private final String[] paths;
/**
* Constructs a {@link ProxyRenderer} with a given set of paths.
- *
+ *
* @param paths an Array of Strings
*/
public ProxyRenderer(String[] paths) {
@@ -39,7 +38,7 @@
/**
* The properties required by this renderer.
- *
+ *
* @return an Array of String paths
*/
public String[] getPaths() {
diff --git a/user/src/com/google/web/bindery/requestfactory/gwt/ui/client/package-info.java b/user/src/com/google/web/bindery/requestfactory/gwt/ui/client/package-info.java
index f9d62e8..6ad3dcf 100644
--- a/user/src/com/google/web/bindery/requestfactory/gwt/ui/client/package-info.java
+++ b/user/src/com/google/web/bindery/requestfactory/gwt/ui/client/package-info.java
@@ -15,7 +15,9 @@
*/
/**
- * Classes used by the request factory to manage proxies, user logins, and authentication.
+ * Classes used by the request factory to manage proxies, user logins, and
+ * authentication.
*/
@com.google.gwt.util.PreventSpuriousRebuilds
package com.google.web.bindery.requestfactory.gwt.ui.client;
+
diff --git a/user/src/com/google/web/bindery/requestfactory/server/DefaultExceptionHandler.java b/user/src/com/google/web/bindery/requestfactory/server/DefaultExceptionHandler.java
index ab86e5c..489b75a 100644
--- a/user/src/com/google/web/bindery/requestfactory/server/DefaultExceptionHandler.java
+++ b/user/src/com/google/web/bindery/requestfactory/server/DefaultExceptionHandler.java
@@ -23,7 +23,7 @@
*/
public class DefaultExceptionHandler implements ExceptionHandler {
public ServerFailure createServerFailure(Throwable throwable) {
- return new ServerFailure("Server Error: "
- + (throwable == null ? null : throwable.getMessage()), null, null, true);
+ return new ServerFailure(
+ "Server Error: " + (throwable == null ? null : throwable.getMessage()), null, null, true);
}
}
\ No newline at end of file
diff --git a/user/src/com/google/web/bindery/requestfactory/server/LocatorServiceLayer.java b/user/src/com/google/web/bindery/requestfactory/server/LocatorServiceLayer.java
index aa1c5d6..0dee2b8 100644
--- a/user/src/com/google/web/bindery/requestfactory/server/LocatorServiceLayer.java
+++ b/user/src/com/google/web/bindery/requestfactory/server/LocatorServiceLayer.java
@@ -50,19 +50,18 @@
@Override
public Object createServiceInstance(Method contextMethod, Method domainMethod) {
- Class<? extends ServiceLocator> locatorType = getTop().resolveServiceLocator(
- contextMethod, domainMethod);
+ Class<? extends ServiceLocator> locatorType =
+ getTop().resolveServiceLocator(contextMethod, domainMethod);
ServiceLocator locator = getTop().createServiceLocator(locatorType);
// Enclosing class may be a parent class, so invoke on service class
Class<?> declaringClass = contextMethod.getDeclaringClass();
- Class<?> serviceClass = getTop().resolveServiceClass(
- declaringClass.asSubclass(RequestContext.class));
+ Class<?> serviceClass =
+ getTop().resolveServiceClass(declaringClass.asSubclass(RequestContext.class));
return locator.getInstance(serviceClass);
}
@Override
- public <T extends ServiceLocator> T createServiceLocator(
- Class<T> serviceLocatorType) {
+ public <T extends ServiceLocator> T createServiceLocator(Class<T> serviceLocatorType) {
return newInstance(serviceLocatorType, ServiceLocator.class);
}
@@ -100,8 +99,7 @@
* method is non-static.
*/
@Override
- public boolean requiresServiceLocator(Method contextMethod,
- Method domainMethod) {
+ public boolean requiresServiceLocator(Method contextMethod, Method domainMethod) {
return Request.class.isAssignableFrom(contextMethod.getReturnType())
&& !Modifier.isStatic(domainMethod.getModifiers());
}
@@ -109,8 +107,7 @@
@Override
public Class<? extends Locator<?, ?>> resolveLocator(Class<?> domainType) {
// Find the matching BaseProxy
- Class<?> proxyType = getTop().resolveClientType(domainType,
- BaseProxy.class, false);
+ Class<?> proxyType = getTop().resolveClientType(domainType, BaseProxy.class, false);
if (proxyType == null) {
return null;
}
@@ -126,14 +123,12 @@
} else if (ln != null && ln.locator().length() > 0) {
try {
@SuppressWarnings("unchecked")
- Class<? extends Locator<?, ?>> found = (Class<? extends Locator<?, ?>>) Class.forName(
- ln.locator(), false, getTop().getDomainClassLoader()).asSubclass(
- Locator.class);
+ Class<? extends Locator<?, ?>> found =
+ (Class<? extends Locator<?, ?>>) Class.forName(ln.locator(), false,
+ getTop().getDomainClassLoader()).asSubclass(Locator.class);
locatorType = found;
} catch (ClassNotFoundException e) {
- return die(
- e,
- "Could not find the locator type specified in the @%s annotation %s",
+ return die(e, "Could not find the locator type specified in the @%s annotation %s",
ProxyForName.class.getCanonicalName(), ln.value());
}
} else {
@@ -144,8 +139,8 @@
}
@Override
- public Class<? extends ServiceLocator> resolveServiceLocator(
- Method contextMethod, Method domainMethod) {
+ public Class<? extends ServiceLocator> resolveServiceLocator(Method contextMethod,
+ Method domainMethod) {
Class<? extends ServiceLocator> locatorType;
// Look at the RequestContext
@@ -156,12 +151,11 @@
locatorType = l.locator();
} else if (ln != null && ln.locator().length() > 0) {
try {
- locatorType = Class.forName(ln.locator(), false,
- getTop().getDomainClassLoader()).asSubclass(ServiceLocator.class);
+ locatorType =
+ Class.forName(ln.locator(), false, getTop().getDomainClassLoader()).asSubclass(
+ ServiceLocator.class);
} catch (ClassNotFoundException e) {
- return die(
- e,
- "Could not find the locator type specified in the @%s annotation %s",
+ return die(e, "Could not find the locator type specified in the @%s annotation %s",
ServiceName.class.getCanonicalName(), ln.value());
}
} else {
@@ -212,8 +206,7 @@
@SuppressWarnings("unchecked")
private <T, I> Locator<T, I> getLocator(Class<T> domainType) {
- Class<? extends Locator<?, ?>> locatorType = getTop().resolveLocator(
- domainType);
+ Class<? extends Locator<?, ?>> locatorType = getTop().resolveLocator(domainType);
if (locatorType == null) {
return null;
}
@@ -229,8 +222,7 @@
} catch (IllegalAccessException e) {
ex = e;
}
- return this.<T> die(ex,
- "Could not instantiate %s %s. Is it default-instantiable?",
- base.getSimpleName(), clazz.getCanonicalName());
+ return this.<T> die(ex, "Could not instantiate %s %s. Is it default-instantiable?", base
+ .getSimpleName(), clazz.getCanonicalName());
}
}
diff --git a/user/src/com/google/web/bindery/requestfactory/server/Logging.java b/user/src/com/google/web/bindery/requestfactory/server/Logging.java
index 1f8142f..73c6f54 100644
--- a/user/src/com/google/web/bindery/requestfactory/server/Logging.java
+++ b/user/src/com/google/web/bindery/requestfactory/server/Logging.java
@@ -25,22 +25,21 @@
/**
* Server side object that handles log messages sent by
- * {@link com.google.web.bindery.requestfactory.gwt.client.RequestFactoryLogHandler}.
+ * {@link com.google.web.bindery.requestfactory.gwt.client.RequestFactoryLogHandler}
+ * .
*/
public class Logging {
- private static StackTraceDeobfuscator deobfuscator = new StackTraceDeobfuscator(
- "");
+ private static StackTraceDeobfuscator deobfuscator = new StackTraceDeobfuscator("");
/**
* Logs a message.
*
* @param logRecordJson a json serialized LogRecord, as provided by
- * {@link com.google.gwt.logging.client.JsonLogRecordClientUtil#logRecordAsJsonObject(LogRecord)}
+ * {@link com.google.gwt.logging.client.JsonLogRecordClientUtil#logRecordAsJsonObject(LogRecord)}
* @throws RemoteLoggingException if logging fails
*/
- public static void logMessage(String logRecordJson)
- throws RemoteLoggingException {
+ public static void logMessage(String logRecordJson) throws RemoteLoggingException {
/*
* if the header does not exist, we pass null, which is handled gracefully
* by the deobfuscation code.
@@ -51,8 +50,7 @@
// can be null during tests
strongName = threadLocalRequest.getHeader(RpcRequestBuilder.STRONG_NAME_HEADER);
}
- RemoteLoggingServiceUtil.logOnServer(logRecordJson, strongName,
- deobfuscator, null);
+ RemoteLoggingServiceUtil.logOnServer(logRecordJson, strongName, deobfuscator, null);
}
/**
diff --git a/user/src/com/google/web/bindery/requestfactory/server/ReflectiveServiceLayer.java b/user/src/com/google/web/bindery/requestfactory/server/ReflectiveServiceLayer.java
index 3433518..dc9e67c 100644
--- a/user/src/com/google/web/bindery/requestfactory/server/ReflectiveServiceLayer.java
+++ b/user/src/com/google/web/bindery/requestfactory/server/ReflectiveServiceLayer.java
@@ -70,8 +70,7 @@
* Linear search, but we want to handle getFoo, isFoo, and hasFoo. The result
* of this method will be cached by the ServiceLayerCache.
*/
- private static Method getBeanMethod(BeanMethod methodType,
- Class<?> domainType, String property) {
+ private static Method getBeanMethod(BeanMethod methodType, Class<?> domainType, String property) {
for (Method m : domainType.getMethods()) {
if (methodType.matches(m) && property.equals(methodType.inferName(m))) {
m.setAccessible(true);
@@ -102,9 +101,8 @@
} catch (IllegalArgumentException e) {
ex = e;
}
- return this.<T> die(ex,
- "Could not create a new instance of domain type %s",
- clazz.getCanonicalName());
+ return this.<T> die(ex, "Could not create a new instance of domain type %s", clazz
+ .getCanonicalName());
}
@Override
@@ -127,8 +125,8 @@
try {
Method getter = getTop().getGetter(domainObject.getClass(), property);
if (getter == null) {
- die(null, "Could not determine getter for property %s on type %s",
- property, domainObject.getClass().getCanonicalName());
+ die(null, "Could not determine getter for property %s on type %s", property, domainObject
+ .getClass().getCanonicalName());
}
Object value = getter.invoke(domainObject);
return value;
@@ -143,17 +141,17 @@
public Type getRequestReturnType(Method contextMethod) {
Class<?> returnClass = contextMethod.getReturnType();
if (InstanceRequest.class.isAssignableFrom(returnClass)) {
- Type[] params = TypeUtils.getParameterization(InstanceRequest.class,
- contextMethod.getGenericReturnType());
+ Type[] params =
+ TypeUtils
+ .getParameterization(InstanceRequest.class, contextMethod.getGenericReturnType());
assert params.length == 2;
return params[1];
} else if (Request.class.isAssignableFrom(returnClass)) {
- Type param = TypeUtils.getSingleParameterization(Request.class,
- contextMethod.getGenericReturnType());
+ Type param =
+ TypeUtils.getSingleParameterization(Request.class, contextMethod.getGenericReturnType());
return param;
} else {
- return die(null, "Unknown RequestContext return type %s",
- returnClass.getCanonicalName());
+ return die(null, "Unknown RequestContext return type %s", returnClass.getCanonicalName());
}
}
@@ -211,12 +209,10 @@
}
@Override
- public List<Object> loadDomainObjects(List<Class<?>> classes,
- List<Object> domainIds) {
+ public List<Object> loadDomainObjects(List<Class<?>> classes, List<Object> domainIds) {
if (classes.size() != domainIds.size()) {
- die(null,
- "Size mismatch in paramaters. classes.size() = %d domainIds.size=%d",
- classes.size(), domainIds.size());
+ die(null, "Size mismatch in paramaters. classes.size() = %d domainIds.size=%d", classes
+ .size(), domainIds.size());
}
List<Object> toReturn = new ArrayList<Object>(classes.size());
Iterator<Class<?>> classIt = classes.iterator();
@@ -228,13 +224,12 @@
}
@Override
- public void setProperty(Object domainObject, String property,
- Class<?> expectedType, Object value) {
+ public void setProperty(Object domainObject, String property, Class<?> expectedType, Object value) {
try {
Method setter = getTop().getSetter(domainObject.getClass(), property);
if (setter == null) {
- die(null, "Could not locate setter for property %s in type %s",
- property, domainObject.getClass().getCanonicalName());
+ die(null, "Could not locate setter for property %s in type %s", property, domainObject
+ .getClass().getCanonicalName());
}
setter.invoke(domainObject, value);
return;
@@ -255,8 +250,7 @@
private Method getFind(Class<?> clazz) {
if (clazz == null) {
- return die(null, "Could not find static method with a single"
- + " parameter of a key type");
+ return die(null, "Could not find static method with a single" + " parameter of a key type");
}
String searchFor = "find" + clazz.getSimpleName();
for (Method method : clazz.getMethods()) {
@@ -286,7 +280,7 @@
return true;
}
- return BaseProxy.class.isAssignableFrom(getTop().resolveClientType(
- domainClass, BaseProxy.class, true));
+ return BaseProxy.class.isAssignableFrom(getTop().resolveClientType(domainClass,
+ BaseProxy.class, true));
}
}
diff --git a/user/src/com/google/web/bindery/requestfactory/server/RequestFactoryInterfaceValidator.java b/user/src/com/google/web/bindery/requestfactory/server/RequestFactoryInterfaceValidator.java
index 645c199..4aa5bab 100644
--- a/user/src/com/google/web/bindery/requestfactory/server/RequestFactoryInterfaceValidator.java
+++ b/user/src/com/google/web/bindery/requestfactory/server/RequestFactoryInterfaceValidator.java
@@ -152,8 +152,7 @@
public void poison(String msg, Object... args) {
poison();
- logger.logp(Level.SEVERE, currentType(), currentMethod(),
- String.format(msg, args));
+ logger.logp(Level.SEVERE, currentType(), currentMethod(), String.format(msg, args));
validator.poisoned = true;
}
@@ -176,8 +175,7 @@
}
public void spam(String msg, Object... args) {
- logger.logp(Level.FINEST, currentType(), currentMethod(),
- String.format(msg, args));
+ logger.logp(Level.FINEST, currentType(), currentMethod(), String.format(msg, args));
}
protected ErrorContext fork() {
@@ -254,8 +252,8 @@
}
@Override
- public void visit(int version, int access, String name, String signature,
- String superName, String[] interfaces) {
+ public void visit(int version, int access, String name, String signature, String superName,
+ String[] interfaces) {
if ((access & Opcodes.ACC_INTERFACE) == 0) {
logger.poison("Type must be an interface");
}
@@ -354,8 +352,7 @@
for (Class<?> clazz : found) {
sb.append(" @").append(clazz.getSimpleName());
}
- logger.poison("Redundant domain mapping annotations present:%s",
- sb.toString());
+ logger.poison("Redundant domain mapping annotations present:%s", sb.toString());
}
}
}
@@ -379,14 +376,14 @@
Map<RFMethod, RFMethod> toReturn = new HashMap<RFMethod, RFMethod>();
// Return most-derived methods
for (RFMethod method : methods) {
- RFMethod key = new RFMethod(method.getName(), Type.getMethodDescriptor(
- Type.VOID_TYPE, method.getArgumentTypes()));
+ RFMethod key =
+ new RFMethod(method.getName(), Type.getMethodDescriptor(Type.VOID_TYPE, method
+ .getArgumentTypes()));
RFMethod compareTo = toReturn.get(key);
if (compareTo == null) {
toReturn.put(key, method);
- } else if (isAssignable(logger, compareTo.getReturnType(),
- method.getReturnType())) {
+ } else if (isAssignable(logger, compareTo.getReturnType(), method.getReturnType())) {
toReturn.put(key, method);
}
}
@@ -395,8 +392,8 @@
}
@Override
- public void visit(int version, int access, String name, String signature,
- String superName, String[] interfaces) {
+ public void visit(int version, int access, String name, String signature, String superName,
+ String[] interfaces) {
if (!seen.add(name)) {
return;
}
@@ -411,8 +408,8 @@
}
@Override
- public MethodVisitor visitMethod(int access, String name, String desc,
- String signature, String[] exceptions) {
+ public MethodVisitor visitMethod(int access, String name, String desc, String signature,
+ String[] exceptions) {
// Ignore initializers
if ("<clinit>".equals(name) || "<init>".equals(name)) {
return null;
@@ -483,14 +480,13 @@
}
public List<Type> exec(Type type) {
- RequestFactoryInterfaceValidator.this.visit(logger,
- type.getInternalName(), this);
+ RequestFactoryInterfaceValidator.this.visit(logger, type.getInternalName(), this);
return supers;
}
@Override
- public void visit(int version, int access, String name, String signature,
- String superName, String[] interfaces) {
+ public void visit(int version, int access, String name, String signature, String superName,
+ String[] interfaces) {
if (!seen.add(name)) {
return;
}
@@ -576,18 +572,17 @@
+ " com.example.MyRequestFactory");
System.exit(1);
}
- RequestFactoryInterfaceValidator validator = new RequestFactoryInterfaceValidator(
- Logger.getLogger(RequestFactoryInterfaceValidator.class.getName()),
- new ClassLoaderLoader(Thread.currentThread().getContextClassLoader()));
+ RequestFactoryInterfaceValidator validator =
+ new RequestFactoryInterfaceValidator(Logger
+ .getLogger(RequestFactoryInterfaceValidator.class.getName()), new ClassLoaderLoader(
+ Thread.currentThread().getContextClassLoader()));
validator.validateRequestFactory(args[0]);
System.exit(validator.isPoisoned() ? 1 : 0);
}
- static String messageCouldNotFindMethod(Type domainType,
- List<? extends Method> methods) {
+ static String messageCouldNotFindMethod(Type domainType, List<? extends Method> methods) {
StringBuilder sb = new StringBuilder();
- sb.append(String.format(
- "Could not find matching method in %s.\nPossible matches:\n",
+ sb.append(String.format("Could not find matching method in %s.\nPossible matches:\n",
print(domainType)));
for (Method domainMethod : methods) {
sb.append(" ").append(print(domainMethod)).append("\n");
@@ -597,8 +592,7 @@
private static String print(Method method) {
StringBuilder sb = new StringBuilder();
- sb.append(print(method.getReturnType())).append(" ").append(
- method.getName()).append("(");
+ sb.append(print(method.getReturnType())).append(" ").append(method.getName()).append("(");
for (Type t : method.getArgumentTypes()) {
sb.append(print(t)).append(" ");
}
@@ -776,8 +770,8 @@
} else if (isAssignable(parentLogger, valueProxyIntf, proxyType)) {
validateValueProxy(binaryName);
} else {
- parentLogger.poison("%s is neither an %s nor a %s", print(proxyType),
- print(entityProxyIntf), print(valueProxyIntf));
+ parentLogger.poison("%s is neither an %s nor a %s", print(proxyType), print(entityProxyIntf),
+ print(valueProxyIntf));
}
}
@@ -815,30 +809,28 @@
// Quick sanity check for calling code
if (!isAssignable(logger, requestContextIntf, requestContextType)) {
- logger.poison("%s is not a %s", print(requestContextType),
- RequestContext.class.getSimpleName());
+ logger.poison("%s is not a %s", print(requestContextType), RequestContext.class
+ .getSimpleName());
return;
}
Type domainServiceType = getDomainType(logger, requestContextType);
if (domainServiceType == errorType) {
- logger.poison(
- "The type %s must be annotated with a @%s or @%s annotation",
- BinaryName.toSourceName(binaryName), Service.class.getSimpleName(),
- ServiceName.class.getSimpleName());
+ logger.poison("The type %s must be annotated with a @%s or @%s annotation", BinaryName
+ .toSourceName(binaryName), Service.class.getSimpleName(), ServiceName.class
+ .getSimpleName());
return;
}
for (RFMethod method : getMethodsInHierarchy(logger, requestContextType)) {
// Ignore methods in RequestContext itself
- if (findCompatibleMethod(logger, requestContextIntf, method, false, true,
- true) != null) {
+ if (findCompatibleMethod(logger, requestContextIntf, method, false, true, true) != null) {
continue;
}
// Check the client method against the domain
- checkClientMethodInDomain(logger, method, domainServiceType,
- !clientToLocatorMap.containsKey(requestContextType));
+ checkClientMethodInDomain(logger, method, domainServiceType, !clientToLocatorMap
+ .containsKey(requestContextType));
maybeCheckReferredProxies(logger, method);
}
@@ -872,16 +864,14 @@
ErrorContext logger = parentLogger.setType(requestFactoryType);
// Quick sanity check for calling code
- if (!isAssignable(logger, Type.getType(RequestFactory.class),
- requestFactoryType)) {
- logger.poison("%s is not a %s", print(requestFactoryType),
- RequestFactory.class.getSimpleName());
+ if (!isAssignable(logger, Type.getType(RequestFactory.class), requestFactoryType)) {
+ logger.poison("%s is not a %s", print(requestFactoryType), RequestFactory.class
+ .getSimpleName());
return;
}
// Validate each RequestContext method in the RF
- for (Method contextMethod : getMethodsInHierarchy(logger,
- requestFactoryType)) {
+ for (Method contextMethod : getMethodsInHierarchy(logger, requestFactoryType)) {
Type returnType = contextMethod.getReturnType();
if (isAssignable(logger, requestContextIntf, returnType)) {
validateRequestContext(returnType.getClassName());
@@ -924,8 +914,7 @@
* {@code domainTypeBinaryName} and assignable to {@code clientTypeBinaryName}
* , the first matching type will be returned.
*/
- String getEntityProxyTypeName(String domainTypeBinaryName,
- String clientTypeBinaryName) {
+ String getEntityProxyTypeName(String domainTypeBinaryName, String clientTypeBinaryName) {
Type key = Type.getObjectType(BinaryName.toInternalName(domainTypeBinaryName));
List<Type> found = domainToClientType.get(key);
@@ -974,8 +963,7 @@
* Record the mapping of a domain type to a client type. Proxy types will be
* added to {@link #domainToClientType}.
*/
- private void addToDomainMap(ErrorContext logger, Type domainType,
- Type clientType) {
+ private void addToDomainMap(ErrorContext logger, Type domainType, Type clientType) {
clientToDomainType.put(clientType, domainType);
if (isAssignable(logger, baseProxyIntf, clientType)) {
@@ -1000,24 +988,23 @@
// Create a "translated" method declaration to search for
// Request<BlahProxy> foo(int a, BarProxy bar) -> Blah foo(int a, Bar bar);
Type returnType = getReturnType(logger, method);
- Method searchFor = createDomainMethod(logger, new Method(method.getName(),
- returnType, method.getArgumentTypes()));
+ Method searchFor =
+ createDomainMethod(logger, new Method(method.getName(), returnType, method
+ .getArgumentTypes()));
- RFMethod found = findCompatibleServiceMethod(logger, domainServiceType,
- searchFor, !method.isValidationSkipped());
+ RFMethod found =
+ findCompatibleServiceMethod(logger, domainServiceType, searchFor, !method
+ .isValidationSkipped());
if (found != null) {
- boolean isInstance = isAssignable(logger, instanceRequestIntf,
- method.getReturnType());
+ boolean isInstance = isAssignable(logger, instanceRequestIntf, method.getReturnType());
if (isInstance && found.isDeclaredStatic()) {
logger.poison("The method %s is declared to return %s, but the"
- + " service method is static", method.getName(),
- InstanceRequest.class.getCanonicalName());
- } else if (requireStaticMethodsForRequestType && !isInstance
- && !found.isDeclaredStatic()) {
+ + " service method is static", method.getName(), InstanceRequest.class
+ .getCanonicalName());
+ } else if (requireStaticMethodsForRequestType && !isInstance && !found.isDeclaredStatic()) {
logger.poison("The method %s is declared to return %s, but the"
- + " service method is not static", method.getName(),
- Request.class.getCanonicalName());
+ + " service method is not static", method.getName(), Request.class.getCanonicalName());
}
}
}
@@ -1031,8 +1018,7 @@
return;
}
logger = logger.setType(domainType);
- String findMethodName = "find"
- + BinaryName.getShortClassName(domainType.getClassName());
+ String findMethodName = "find" + BinaryName.getShortClassName(domainType.getClassName());
Type keyType = null;
RFMethod findMethod = null;
@@ -1040,21 +1026,18 @@
boolean foundId = false;
boolean foundVersion = false;
for (RFMethod method : getMethodsInHierarchy(logger, domainType)) {
- if ("getId".equals(method.getName())
- && method.getArgumentTypes().length == 0) {
+ if ("getId".equals(method.getName()) && method.getArgumentTypes().length == 0) {
foundId = true;
keyType = method.getReturnType();
if (!isResolvedKeyType(logger, keyType)) {
unresolvedKeyTypes.put(domainType, keyType);
}
- } else if ("getVersion".equals(method.getName())
- && method.getArgumentTypes().length == 0) {
+ } else if ("getVersion".equals(method.getName()) && method.getArgumentTypes().length == 0) {
foundVersion = true;
if (!isResolvedKeyType(logger, method.getReturnType())) {
unresolvedKeyTypes.put(domainType, method.getReturnType());
}
- } else if (findMethodName.equals(method.getName())
- && method.getArgumentTypes().length == 1) {
+ } else if (findMethodName.equals(method.getName()) && method.getArgumentTypes().length == 1) {
foundFind = true;
findMethod = method;
}
@@ -1066,23 +1049,21 @@
logger.poison("There is no getId() method in type %s", print(domainType));
}
if (!foundVersion) {
- logger.poison("There is no getVersion() method in type %s",
- print(domainType));
+ logger.poison("There is no getVersion() method in type %s", print(domainType));
}
if (foundFind) {
- if (keyType != null
- && !isAssignable(logger, findMethod.getArgumentTypes()[0], keyType)) {
+ if (keyType != null && !isAssignable(logger, findMethod.getArgumentTypes()[0], keyType)) {
logger.poison("The key type returned by %s getId()"
- + " cannot be used as the argument to %s(%s)", print(keyType),
- findMethod.getName(), print(findMethod.getArgumentTypes()[0]));
+ + " cannot be used as the argument to %s(%s)", print(keyType), findMethod.getName(),
+ print(findMethod.getArgumentTypes()[0]));
}
if (!findMethod.isDeclaredStatic()) {
logger.poison("The %s method must be static", findMethodName);
}
} else {
- logger.poison("There is no %s method in type %s that returns %2$s",
- findMethodName, print(domainType));
+ logger.poison("There is no %s method in type %s that returns %2$s", findMethodName,
+ print(domainType));
}
}
@@ -1090,13 +1071,12 @@
* Ensure that the given property method on an EntityProxy exists on the
* domain object.
*/
- private void checkPropertyMethod(ErrorContext logger,
- RFMethod clientPropertyMethod, Type domainType) {
+ private void checkPropertyMethod(ErrorContext logger, RFMethod clientPropertyMethod,
+ Type domainType) {
logger = logger.setMethod(clientPropertyMethod);
- findCompatiblePropertyMethod(logger, domainType,
- createDomainMethod(logger, clientPropertyMethod),
- !clientPropertyMethod.isValidationSkipped());
+ findCompatiblePropertyMethod(logger, domainType, createDomainMethod(logger,
+ clientPropertyMethod), !clientPropertyMethod.isValidationSkipped());
}
private void checkUnresolvedKeyTypes(ErrorContext logger) {
@@ -1108,9 +1088,8 @@
for (Map.Entry<Type, Type> type : unresolvedKeyTypes.entrySet()) {
logger.setType(type.getKey()).poison(
"The domain type %s uses a non-simple key type (%s)"
- + " in its getId() or getVersion() method that"
- + " does not have a proxy mapping.", print(type.getKey()),
- print(type.getValue()));
+ + " in its getId() or getVersion() method that" + " does not have a proxy mapping.",
+ print(type.getKey()), print(type.getValue()));
}
}
@@ -1138,8 +1117,7 @@
// Allow the poisoned flag to be reset without losing data
if (badTypes.contains(binaryName)) {
- parentLogger.poison("Type type %s was previously marked as bad",
- binaryName);
+ parentLogger.poison("Type type %s was previously marked as bad", binaryName);
return true;
}
@@ -1154,9 +1132,8 @@
* Finds a compatible method declaration in <code>domainType</code>'s
* hierarchy that is assignment-compatible with the given Method.
*/
- private RFMethod findCompatibleMethod(final ErrorContext logger,
- Type domainType, Method searchFor, boolean mustFind,
- boolean allowOverloads, boolean boxReturnTypes) {
+ private RFMethod findCompatibleMethod(final ErrorContext logger, Type domainType,
+ Method searchFor, boolean mustFind, boolean allowOverloads, boolean boxReturnTypes) {
String methodName = searchFor.getName();
Type[] clientArgs = searchFor.getArgumentTypes();
Type clientReturnType = searchFor.getReturnType();
@@ -1178,15 +1155,14 @@
List<RFMethod> methods = domainLookup.get(methodName);
if (methods == null) {
if (mustFind) {
- logger.poison("Could not find any methods named %s in %s", methodName,
- print(domainType));
+ logger.poison("Could not find any methods named %s in %s", methodName, print(domainType));
}
return null;
}
if (methods.size() > 1 && !allowOverloads) {
StringBuilder sb = new StringBuilder();
- sb.append(String.format("Method overloads found in type %s named %s:\n",
- print(domainType), methodName));
+ sb.append(String.format("Method overloads found in type %s named %s:\n", print(domainType),
+ methodName));
for (RFMethod method : methods) {
sb.append(" ").append(print(method)).append("\n");
}
@@ -1214,8 +1190,7 @@
if (isAssignable(logger, domainArgs, clientArgs)
&& isAssignable(logger, clientReturnType, domainReturnType)) {
- logger.spam("Mapped client method " + print(searchFor) + " to "
- + print(domainMethod));
+ logger.spam("Mapped client method " + print(searchFor) + " to " + print(domainMethod));
return domainMethod;
}
}
@@ -1229,20 +1204,18 @@
* Finds a compatible method declaration in <code>domainType</code>'s
* hierarchy that is assignment-compatible with the given Method.
*/
- private RFMethod findCompatiblePropertyMethod(final ErrorContext logger,
- Type domainType, Method searchFor, boolean mustFind) {
- return findCompatibleMethod(logger, domainType, searchFor, mustFind, false,
- false);
+ private RFMethod findCompatiblePropertyMethod(final ErrorContext logger, Type domainType,
+ Method searchFor, boolean mustFind) {
+ return findCompatibleMethod(logger, domainType, searchFor, mustFind, false, false);
}
/**
* Finds a compatible method declaration in <code>domainType</code>'s
* hierarchy that is assignment-compatible with the given Method.
*/
- private RFMethod findCompatibleServiceMethod(final ErrorContext logger,
- Type domainType, Method searchFor, boolean mustFind) {
- return findCompatibleMethod(logger, domainType, searchFor, mustFind, false,
- true);
+ private RFMethod findCompatibleServiceMethod(final ErrorContext logger, Type domainType,
+ Method searchFor, boolean mustFind) {
+ return findCompatibleMethod(logger, domainType, searchFor, mustFind, false, true);
}
/**
@@ -1270,8 +1243,7 @@
case Type.VOID:
return Type.getType(Void.class);
}
- throw new RuntimeException(primitive.getDescriptor()
- + " is not a primitive type");
+ throw new RuntimeException(primitive.getDescriptor() + " is not a primitive type");
}
/**
@@ -1288,17 +1260,15 @@
}
if (isValueType(logger, clientType) || isCollectionType(logger, clientType)) {
domainType = clientType;
- } else if (entityProxyIntf.equals(clientType)
- || valueProxyIntf.equals(clientType)) {
+ } else if (entityProxyIntf.equals(clientType) || valueProxyIntf.equals(clientType)) {
domainType = objectType;
} else {
logger = logger.setType(clientType);
DomainMapper pv = new DomainMapper(logger);
visit(logger, clientType.getInternalName(), pv);
if (pv.getDomainInternalName() == null) {
- logger.poison("%s has no mapping to a domain type (e.g. @%s or @%s)",
- print(clientType), ProxyFor.class.getSimpleName(),
- Service.class.getSimpleName());
+ logger.poison("%s has no mapping to a domain type (e.g. @%s or @%s)", print(clientType),
+ ProxyFor.class.getSimpleName(), Service.class.getSimpleName());
domainType = errorType;
} else {
domainType = Type.getObjectType(pv.getDomainInternalName());
@@ -1316,8 +1286,7 @@
/**
* Collect all of the methods defined within a type hierarchy.
*/
- private Set<RFMethod> getMethodsInHierarchy(ErrorContext logger,
- Type domainType) {
+ private Set<RFMethod> getMethodsInHierarchy(ErrorContext logger, Type domainType) {
Set<RFMethod> toReturn = methodsInHierarchy.get(domainType);
if (toReturn == null) {
logger = logger.setType(domainType);
@@ -1392,8 +1361,7 @@
return toReturn;
}
- private boolean isAssignable(ErrorContext logger, Type possibleSupertype,
- Type possibleSubtype) {
+ private boolean isAssignable(ErrorContext logger, Type possibleSupertype, Type possibleSubtype) {
// Fast-path for same type
if (possibleSupertype.equals(possibleSubtype)) {
return true;
@@ -1418,8 +1386,7 @@
return true;
}
- private boolean isCollectionType(
- @SuppressWarnings("unused") ErrorContext logger, Type type) {
+ private boolean isCollectionType(@SuppressWarnings("unused") ErrorContext logger, Type type) {
// keeping the logger arg just for internal consistency for our small minds
return "java/util/List".equals(type.getInternalName())
|| "java/util/Set".equals(type.getInternalName());
@@ -1500,8 +1467,7 @@
}
}
- private void validateProxy(String binaryName, Type expectedType,
- boolean requireId) {
+ private void validateProxy(String binaryName, Type expectedType, boolean requireId) {
if (fastFail(binaryName)) {
return;
}
@@ -1511,18 +1477,16 @@
// Quick sanity check for calling code
if (!isAssignable(logger, expectedType, proxyType)) {
- parentLogger.poison("%s is not a %s", print(proxyType),
- print(expectedType));
+ parentLogger.poison("%s is not a %s", print(proxyType), print(expectedType));
return;
}
// Find the domain type
Type domainType = getDomainType(logger, proxyType);
if (domainType == errorType) {
- logger.poison(
- "The type %s must be annotated with a @%s or @%s annotation",
- BinaryName.toSourceName(binaryName), ProxyFor.class.getSimpleName(),
- ProxyForName.class.getSimpleName());
+ logger.poison("The type %s must be annotated with a @%s or @%s annotation", BinaryName
+ .toSourceName(binaryName), ProxyFor.class.getSimpleName(), ProxyForName.class
+ .getSimpleName());
return;
}
@@ -1535,8 +1499,7 @@
}
// Collect all methods in the client proxy type
- Set<RFMethod> clientPropertyMethods = getMethodsInHierarchy(logger,
- proxyType);
+ Set<RFMethod> clientPropertyMethods = getMethodsInHierarchy(logger, proxyType);
// Find the equivalent domain getter/setter method
for (RFMethod clientPropertyMethod : clientPropertyMethods) {
@@ -1556,8 +1519,7 @@
*
* @return <code>true</code> if the visitor was successfully visited
*/
- private boolean visit(ErrorContext logger, String internalName,
- ClassVisitor visitor) {
+ private boolean visit(ErrorContext logger, String internalName, ClassVisitor visitor) {
assert Name.isInternalName(internalName) : "internalName";
logger.spam("Visiting " + internalName);
InputStream inputStream = null;
diff --git a/user/src/com/google/web/bindery/requestfactory/server/RequestFactoryJarExtractor.java b/user/src/com/google/web/bindery/requestfactory/server/RequestFactoryJarExtractor.java
index fc6c173..bbb33b4 100644
--- a/user/src/com/google/web/bindery/requestfactory/server/RequestFactoryJarExtractor.java
+++ b/user/src/com/google/web/bindery/requestfactory/server/RequestFactoryJarExtractor.java
@@ -618,7 +618,7 @@
* Maximum number of threads to use to run the Extractor.
*/
private static final int MAX_THREADS = 4;
-
+
static {
List<Class<?>> sharedClasses = Arrays.<Class<?>> asList(SHARED_CLASSES);
@@ -764,7 +764,7 @@
} catch (InterruptedException retry) {
} catch (ExecutionException e) {
e.getCause().printStackTrace();
- executionFailed = true;
+ executionFailed = true;
}
}
emitter.close();
diff --git a/user/src/com/google/web/bindery/requestfactory/server/RequestFactoryServlet.java b/user/src/com/google/web/bindery/requestfactory/server/RequestFactoryServlet.java
index fca199e..15ad741 100644
--- a/user/src/com/google/web/bindery/requestfactory/server/RequestFactoryServlet.java
+++ b/user/src/com/google/web/bindery/requestfactory/server/RequestFactoryServlet.java
@@ -38,15 +38,19 @@
private static final boolean DUMP_PAYLOAD = Boolean.getBoolean("gwt.rpc.dumpPayload");
private static final String JSON_CHARSET = "UTF-8";
private static final String JSON_CONTENT_TYPE = "application/json";
- private static final Logger log = Logger.getLogger(RequestFactoryServlet.class.getCanonicalName());
+ private static final Logger log = Logger
+ .getLogger(RequestFactoryServlet.class.getCanonicalName());
/**
* These ThreadLocals are used to allow service objects to obtain access to
* the HTTP transaction.
*/
- private static final ThreadLocal<ServletContext> perThreadContext = new ThreadLocal<ServletContext>();
- private static final ThreadLocal<HttpServletRequest> perThreadRequest = new ThreadLocal<HttpServletRequest>();
- private static final ThreadLocal<HttpServletResponse> perThreadResponse = new ThreadLocal<HttpServletResponse>();
+ private static final ThreadLocal<ServletContext> perThreadContext =
+ new ThreadLocal<ServletContext>();
+ private static final ThreadLocal<HttpServletRequest> perThreadRequest =
+ new ThreadLocal<HttpServletRequest>();
+ private static final ThreadLocal<HttpServletResponse> perThreadResponse =
+ new ThreadLocal<HttpServletResponse>();
/**
* Returns the thread-local {@link HttpServletRequest}.
@@ -96,8 +100,7 @@
*/
public RequestFactoryServlet(ExceptionHandler exceptionHandler,
ServiceLayerDecorator... serviceDecorators) {
- processor = new SimpleRequestProcessor(
- ServiceLayer.create(serviceDecorators));
+ processor = new SimpleRequestProcessor(ServiceLayer.create(serviceDecorators));
processor.setExceptionHandler(exceptionHandler);
}
@@ -120,8 +123,8 @@
// No new code should be placed outside of this try block.
try {
ensureConfig();
- String jsonRequestString = RPCServletUtils.readContent(request,
- JSON_CONTENT_TYPE, JSON_CHARSET);
+ String jsonRequestString =
+ RPCServletUtils.readContent(request, JSON_CONTENT_TYPE, JSON_CHARSET);
if (DUMP_PAYLOAD) {
System.out.println(">>> " + jsonRequestString);
}
@@ -149,8 +152,7 @@
}
private void ensureConfig() {
- String symbolMapsDirectory = getServletConfig().getInitParameter(
- "symbolMapsDirectory");
+ String symbolMapsDirectory = getServletConfig().getInitParameter("symbolMapsDirectory");
if (symbolMapsDirectory != null) {
Logging.setSymbolMapsDirectory(symbolMapsDirectory);
}
diff --git a/user/src/com/google/web/bindery/requestfactory/server/RequestState.java b/user/src/com/google/web/bindery/requestfactory/server/RequestState.java
index e167c41..faea0fc 100644
--- a/user/src/com/google/web/bindery/requestfactory/server/RequestState.java
+++ b/user/src/com/google/web/bindery/requestfactory/server/RequestState.java
@@ -94,7 +94,9 @@
if (ValueCodex.canDecode(domainValue.getClass())) {
flatValue = ValueCodex.encode(domainValue);
} else {
- flatValue = new SimpleRequestProcessor(service).createOobMessage(Collections.singletonList(domainValue));
+ flatValue =
+ new SimpleRequestProcessor(service).createOobMessage(Collections
+ .singletonList(domainValue));
}
return flatValue;
}
@@ -102,8 +104,8 @@
/**
* Get or create a BaseProxy AutoBean for the given id.
*/
- public <Q extends BaseProxy> AutoBean<Q> getBeanForPayload(
- SimpleProxyId<Q> id, Object domainObject) {
+ public <Q extends BaseProxy> AutoBean<Q> getBeanForPayload(SimpleProxyId<Q> id,
+ Object domainObject) {
@SuppressWarnings("unchecked")
AutoBean<Q> toReturn = (AutoBean<Q>) beans.get(id);
if (toReturn == null) {
@@ -115,33 +117,30 @@
/**
* EntityCodex support.
*/
- public <Q extends BaseProxy> AutoBean<Q> getBeanForPayload(
- Splittable serializedProxyId) {
- IdMessage idMessage = AutoBeanCodex.decode(MessageFactoryHolder.FACTORY,
- IdMessage.class, serializedProxyId).as();
+ public <Q extends BaseProxy> AutoBean<Q> getBeanForPayload(Splittable serializedProxyId) {
+ IdMessage idMessage =
+ AutoBeanCodex.decode(MessageFactoryHolder.FACTORY, IdMessage.class, serializedProxyId).as();
@SuppressWarnings("unchecked")
- AutoBean<Q> toReturn = (AutoBean<Q>) getBeansForPayload(
- Collections.singletonList(idMessage)).get(0);
+ AutoBean<Q> toReturn =
+ (AutoBean<Q>) getBeansForPayload(Collections.singletonList(idMessage)).get(0);
return toReturn;
}
/**
* Get or create BaseProxy AutoBeans for a list of id-bearing messages.
*/
- public List<AutoBean<? extends BaseProxy>> getBeansForPayload(
- List<? extends IdMessage> idMessages) {
- List<SimpleProxyId<?>> ids = new ArrayList<SimpleProxyId<?>>(
- idMessages.size());
+ public List<AutoBean<? extends BaseProxy>> getBeansForPayload(List<? extends IdMessage> idMessages) {
+ List<SimpleProxyId<?>> ids = new ArrayList<SimpleProxyId<?>>(idMessages.size());
for (IdMessage idMessage : idMessages) {
SimpleProxyId<?> id;
if (Strength.SYNTHETIC.equals(idMessage.getStrength())) {
Class<? extends BaseProxy> clazz = service.resolveClass(idMessage.getTypeToken());
id = idFactory.allocateSyntheticId(clazz, idMessage.getSyntheticId());
} else {
- String decodedId = idMessage.getServerId() == null ? null
- : SimpleRequestProcessor.fromBase64(idMessage.getServerId());
- id = idFactory.getId(idMessage.getTypeToken(), decodedId,
- idMessage.getClientId());
+ String decodedId =
+ idMessage.getServerId() == null ? null : SimpleRequestProcessor.fromBase64(idMessage
+ .getServerId());
+ id = idFactory.getId(idMessage.getTypeToken(), decodedId, idMessage.getClientId());
}
ids.add(id);
}
@@ -208,10 +207,9 @@
/**
* Creates an AutoBean for the given id, tracking a domain object.
*/
- private <Q extends BaseProxy> AutoBean<Q> createProxyBean(
- SimpleProxyId<Q> id, Object domainObject) {
- AutoBean<Q> toReturn = AutoBeanFactorySource.createBean(id.getProxyClass(),
- SimpleRequestProcessor.CONFIGURATION);
+ private <Q extends BaseProxy> AutoBean<Q> createProxyBean(SimpleProxyId<Q> id, Object domainObject) {
+ AutoBean<Q> toReturn =
+ AutoBeanFactorySource.createBean(id.getProxyClass(), SimpleRequestProcessor.CONFIGURATION);
toReturn.setTag(Constants.STABLE_ID, id);
toReturn.setTag(Constants.DOMAIN_OBJECT, domainObject);
beans.put(id, toReturn);
@@ -222,8 +220,7 @@
* Returns the AutoBeans corresponding to the given ids, or creates them if
* they do not yet exist.
*/
- private List<AutoBean<? extends BaseProxy>> getBeansForIds(
- List<SimpleProxyId<?>> ids) {
+ private List<AutoBean<? extends BaseProxy>> getBeansForIds(List<SimpleProxyId<?>> ids) {
List<Class<?>> domainClasses = new ArrayList<Class<?>>(ids.size());
List<Object> domainIds = new ArrayList<Object>(ids.size());
List<SimpleProxyId<?>> idsToLoad = new ArrayList<SimpleProxyId<?>>();
@@ -254,8 +251,7 @@
if (ValueCodex.canDecode(param)) {
domainParam = ValueCodex.decode(param, split);
} else {
- domainParam = new SimpleRequestProcessor(service).decodeOobMessage(
- param, split).get(0);
+ domainParam = new SimpleRequestProcessor(service).decodeOobMessage(param, split).get(0);
}
// Enqueue
@@ -267,8 +263,7 @@
// Actually load the data
if (!domainClasses.isEmpty()) {
- assert domainClasses.size() == domainIds.size()
- && domainClasses.size() == idsToLoad.size();
+ assert domainClasses.size() == domainIds.size() && domainClasses.size() == idsToLoad.size();
List<Object> loaded = service.loadDomainObjects(domainClasses, domainIds);
if (idsToLoad.size() != loaded.size()) {
throw new UnexpectedException("Expected " + idsToLoad.size()
@@ -285,8 +280,8 @@
}
// Construct the return value
- List<AutoBean<? extends BaseProxy>> toReturn = new ArrayList<AutoBean<? extends BaseProxy>>(
- ids.size());
+ List<AutoBean<? extends BaseProxy>> toReturn =
+ new ArrayList<AutoBean<? extends BaseProxy>>(ids.size());
for (SimpleProxyId<?> id : ids) {
toReturn.add(beans.get(id));
}
diff --git a/user/src/com/google/web/bindery/requestfactory/server/Resolver.java b/user/src/com/google/web/bindery/requestfactory/server/Resolver.java
index 9f641eb..7b8c5a6 100644
--- a/user/src/com/google/web/bindery/requestfactory/server/Resolver.java
+++ b/user/src/com/google/web/bindery/requestfactory/server/Resolver.java
@@ -65,8 +65,7 @@
return false;
}
CollectionType other = (CollectionType) o;
- return rawType.equals(other.rawType)
- && elementType.equals(other.elementType);
+ return rawType.equals(other.rawType) && elementType.equals(other.elementType);
}
public Type[] getActualTypeArguments() {
@@ -100,8 +99,7 @@
public ResolutionKey(Object domainObject, Type requestedType) {
this.domainObject = domainObject;
this.requestedType = requestedType;
- this.hashCode = System.identityHashCode(domainObject) * 13
- + requestedType.hashCode() * 7;
+ this.hashCode = System.identityHashCode(domainObject) * 13 + requestedType.hashCode() * 7;
}
@Override
@@ -191,10 +189,8 @@
* resolution will suffice.
* @param propertyRefs the property references requested by the client
*/
- public Object resolveClientValue(Object domainValue, Type assignableTo,
- Set<String> propertyRefs) {
- return resolveClientValue(domainValue, assignableTo,
- getPropertyRefs(propertyRefs), "");
+ public Object resolveClientValue(Object domainValue, Type assignableTo, Set<String> propertyRefs) {
+ return resolveClientValue(domainValue, assignableTo, getPropertyRefs(propertyRefs), "");
}
/**
@@ -205,8 +201,7 @@
* ReportableException containing a {@link DeadEntityException} if an
* EntityProxy cannot be resolved
*/
- public Object resolveDomainValue(Object maybeEntityProxy,
- boolean detectDeadEntities) {
+ public Object resolveDomainValue(Object maybeEntityProxy, boolean detectDeadEntities) {
if (maybeEntityProxy instanceof BaseProxy) {
AutoBean<BaseProxy> bean = AutoBeanUtils.getAutoBean((BaseProxy) maybeEntityProxy);
Object domain = bean.getTag(Constants.DOMAIN_OBJECT);
@@ -256,9 +251,8 @@
* Converts a domain entity into an EntityProxy that will be sent to the
* client.
*/
- private <T extends BaseProxy> T resolveClientProxy(final Object domainEntity,
- Class<T> proxyType, final Set<String> propertyRefs, ResolutionKey key,
- final String prefix) {
+ private <T extends BaseProxy> T resolveClientProxy(final Object domainEntity, Class<T> proxyType,
+ final Set<String> propertyRefs, ResolutionKey key, final String prefix) {
if (domainEntity == null) {
return null;
}
@@ -291,8 +285,7 @@
* will behave as though it were an object newly-created by the
* client.
*/
- id = state.getIdFactory().allocateSyntheticId(proxyType,
- ++syntheticId);
+ id = state.getIdFactory().allocateSyntheticId(proxyType, ++syntheticId);
} else {
Splittable flatValue = state.flatten(domainId);
id = state.getIdFactory().getId(proxyType, flatValue.getPayload(), 0);
@@ -316,28 +309,28 @@
bean.setTag(Constants.IN_RESPONSE, true);
if (domainVersion != null) {
Splittable flatVersion = state.flatten(domainVersion);
- bean.setTag(Constants.VERSION_PROPERTY_B64,
- SimpleRequestProcessor.toBase64(flatVersion.getPayload()));
+ bean.setTag(Constants.VERSION_PROPERTY_B64, SimpleRequestProcessor.toBase64(flatVersion
+ .getPayload()));
}
bean.accept(new AutoBeanVisitor() {
@Override
- public boolean visitReferenceProperty(String propertyName,
- AutoBean<?> value, PropertyContext ctx) {
+ public boolean visitReferenceProperty(String propertyName, AutoBean<?> value,
+ PropertyContext ctx) {
// Does the user care about the property?
- String newPrefix = (prefix.length() > 0 ? (prefix + ".") : "")
- + propertyName;
+ String newPrefix = (prefix.length() > 0 ? (prefix + ".") : "") + propertyName;
/*
* Send the property if the enclosing type is a ValueProxy, if the owner
* requested the property, or if the property is a list of values.
*/
- Class<?> elementType = ctx instanceof CollectionPropertyContext
- ? ((CollectionPropertyContext) ctx).getElementType() : null;
- boolean shouldSend = isOwnerValueProxy
- || matchesPropertyRef(propertyRefs, newPrefix)
- || elementType != null && ValueCodex.canDecode(elementType);
+ Class<?> elementType =
+ ctx instanceof CollectionPropertyContext ? ((CollectionPropertyContext) ctx)
+ .getElementType() : null;
+ boolean shouldSend =
+ isOwnerValueProxy || matchesPropertyRef(propertyRefs, newPrefix) || elementType != null
+ && ValueCodex.canDecode(elementType);
if (!shouldSend) {
return false;
@@ -356,16 +349,14 @@
} else {
type = new CollectionType(ctx.getType(), elementType);
}
- Object clientValue = resolveClientValue(domainValue, type,
- propertyRefs, newPrefix);
+ Object clientValue = resolveClientValue(domainValue, type, propertyRefs, newPrefix);
ctx.set(clientValue);
return false;
}
@Override
- public boolean visitValueProperty(String propertyName, Object value,
- PropertyContext ctx) {
+ public boolean visitValueProperty(String propertyName, Object value, PropertyContext ctx) {
// Limit unrequested value properties?
value = service.getProperty(domainEntity, propertyName);
ctx.set(value);
@@ -379,8 +370,8 @@
/**
* Recursive-descent implementation.
*/
- private Object resolveClientValue(Object domainValue, Type returnType,
- Set<String> propertyRefs, String prefix) {
+ private Object resolveClientValue(Object domainValue, Type returnType, Set<String> propertyRefs,
+ String prefix) {
if (domainValue == null) {
return null;
}
@@ -398,8 +389,7 @@
return assignableTo.cast(previous);
}
- Class<?> returnClass = service.resolveClientType(domainValue.getClass(),
- assignableTo, true);
+ Class<?> returnClass = service.resolveClientType(domainValue.getClass(), assignableTo, true);
if (anyType) {
assignableTo = returnClass;
@@ -415,8 +405,7 @@
boolean isId = EntityProxyId.class.isAssignableFrom(returnClass);
if (isProxy || isId) {
Class<? extends BaseProxy> proxyClass = assignableTo.asSubclass(BaseProxy.class);
- BaseProxy entity = resolveClientProxy(domainValue, proxyClass,
- propertyRefs, key, prefix);
+ BaseProxy entity = resolveClientProxy(domainValue, proxyClass, propertyRefs, key, prefix);
if (isId) {
return assignableTo.cast(((EntityProxy) entity).stableId());
}
@@ -431,20 +420,17 @@
} else if (Set.class.isAssignableFrom(returnClass)) {
accumulator = new HashSet<Object>();
} else {
- throw new ReportableException("Unsupported collection type"
- + returnClass.getName());
+ throw new ReportableException("Unsupported collection type" + returnClass.getName());
}
resolved.put(key, accumulator);
- Type elementType = TypeUtils.getSingleParameterization(Collection.class,
- returnType);
+ Type elementType = TypeUtils.getSingleParameterization(Collection.class, returnType);
for (Object o : (Collection<?>) domainValue) {
accumulator.add(resolveClientValue(o, elementType, propertyRefs, prefix));
}
return assignableTo.cast(accumulator);
}
- throw new ReportableException("Unsupported domain type "
- + returnClass.getCanonicalName());
+ throw new ReportableException("Unsupported domain type " + returnClass.getCanonicalName());
}
}
diff --git a/user/src/com/google/web/bindery/requestfactory/server/ServiceLayer.java b/user/src/com/google/web/bindery/requestfactory/server/ServiceLayer.java
index 484f954..07d8226 100644
--- a/user/src/com/google/web/bindery/requestfactory/server/ServiceLayer.java
+++ b/user/src/com/google/web/bindery/requestfactory/server/ServiceLayer.java
@@ -61,8 +61,8 @@
public static ServiceLayer create(ServiceLayerDecorator... decorators) {
List<ServiceLayerDecorator> list = new ArrayList<ServiceLayerDecorator>();
// Always hit the cache first
- ServiceLayerDecorator cache = ENABLE_CACHE ? new ServiceLayerCache()
- : new ServiceLayerDecorator();
+ ServiceLayerDecorator cache =
+ ENABLE_CACHE ? new ServiceLayerCache() : new ServiceLayerDecorator();
list.add(cache);
// The the user-provided decorators
if (decorators != null) {
@@ -125,8 +125,7 @@
* @param domainMethod the method that the service object must implement
* @return an instance of the requested service object
*/
- public abstract Object createServiceInstance(Method contextMethod,
- Method domainMethod);
+ public abstract Object createServiceInstance(Method contextMethod, Method domainMethod);
/**
* Create an instance of the requested {@link ServiceLocator} type.
@@ -135,8 +134,7 @@
* @param clazz the requested ServiceLocator type
* @return an instance of the requested ServiceLocator type
*/
- public abstract <T extends ServiceLocator> T createServiceLocator(
- Class<T> clazz);
+ public abstract <T extends ServiceLocator> T createServiceLocator(Class<T> clazz);
/**
* Returns the ClassLoader that should be used when attempting to access
@@ -264,8 +262,7 @@
* @return the requested objects, elements of which may be {@code null} if the
* requested objects were irretrievable
*/
- public abstract List<Object> loadDomainObjects(List<Class<?>> classes,
- List<Object> domainIds);
+ public abstract List<Object> loadDomainObjects(List<Class<?>> classes, List<Object> domainIds);
/**
* Determines if the invocation of a domain method requires a
@@ -276,8 +273,7 @@
* @param domainMethod a domain method
* @return {@code true} if a ServiceLocator is required
*/
- public abstract boolean requiresServiceLocator(Method contextMethod,
- Method domainMethod);
+ public abstract boolean requiresServiceLocator(Method contextMethod, Method domainMethod);
/**
* Given a type token previously returned from
@@ -301,8 +297,8 @@
* @return a class that represents {@code domainClass} on the client which is
* assignable to {@code clientType}
*/
- public abstract <T> Class<? extends T> resolveClientType(
- Class<?> domainClass, Class<T> clientType, boolean required);
+ public abstract <T> Class<? extends T> resolveClientType(Class<?> domainClass,
+ Class<T> clientType, boolean required);
/**
* Determine the domain (server-side) type that the given client type is
@@ -331,8 +327,7 @@
* @return the type of Locator to use, or {@code null} if the type conforms to
* the RequestFactory entity protocol
*/
- public abstract Class<? extends Locator<?, ?>> resolveLocator(
- Class<?> domainType);
+ public abstract Class<? extends Locator<?, ?>> resolveLocator(Class<?> domainType);
/**
* Find a RequestContext method declaration by name.
@@ -344,8 +339,7 @@
* @return the method declaration, or {@code null} if the method does not
* exist
*/
- public abstract Method resolveRequestContextMethod(
- String requestContextClass, String methodName);
+ public abstract Method resolveRequestContextMethod(String requestContextClass, String methodName);
/**
* Given a {@link RequestContext} method, find the service class referenced in
@@ -354,8 +348,7 @@
* @param requestContextClass a RequestContext interface
* @return the type of service to use
*/
- public abstract Class<?> resolveServiceClass(
- Class<? extends RequestContext> requestContextClass);
+ public abstract Class<?> resolveServiceClass(Class<? extends RequestContext> requestContextClass);
/**
* Given a RequestContext method declaration, resolve the
@@ -368,8 +361,8 @@
* @param domainMethod the domain method that will be invoked
* @return the type of ServiceLocator to use
*/
- public abstract Class<? extends ServiceLocator> resolveServiceLocator(
- Method contextMethod, Method domainMethod);
+ public abstract Class<? extends ServiceLocator> resolveServiceLocator(Method contextMethod,
+ Method domainMethod);
/**
* Return a string used to represent the given type in the wire protocol.
@@ -387,8 +380,8 @@
* @param expectedType the type of the property
* @param value the new value
*/
- public abstract void setProperty(Object domainObject, String property,
- Class<?> expectedType, Object value);
+ public abstract void setProperty(Object domainObject, String property, Class<?> expectedType,
+ Object value);
/**
* Invoke a JSR 303 validator on the given domain object. If no validator is
diff --git a/user/src/com/google/web/bindery/requestfactory/server/ServiceLayerDecorator.java b/user/src/com/google/web/bindery/requestfactory/server/ServiceLayerDecorator.java
index b2a7f89..f6c8311 100644
--- a/user/src/com/google/web/bindery/requestfactory/server/ServiceLayerDecorator.java
+++ b/user/src/com/google/web/bindery/requestfactory/server/ServiceLayerDecorator.java
@@ -121,14 +121,12 @@
}
@Override
- public List<Object> loadDomainObjects(List<Class<?>> classes,
- List<Object> domainIds) {
+ public List<Object> loadDomainObjects(List<Class<?>> classes, List<Object> domainIds) {
return getNext().loadDomainObjects(classes, domainIds);
}
@Override
- public boolean requiresServiceLocator(Method contextMethod,
- Method domainMethod) {
+ public boolean requiresServiceLocator(Method contextMethod, Method domainMethod) {
return getNext().requiresServiceLocator(contextMethod, domainMethod);
}
@@ -138,8 +136,8 @@
}
@Override
- public <T> Class<? extends T> resolveClientType(Class<?> domainClass,
- Class<T> clientType, boolean required) {
+ public <T> Class<? extends T> resolveClientType(Class<?> domainClass, Class<T> clientType,
+ boolean required) {
return getNext().resolveClientType(domainClass, clientType, required);
}
@@ -159,21 +157,18 @@
}
@Override
- public Method resolveRequestContextMethod(String requestContextClass,
- String methodName) {
- return getNext().resolveRequestContextMethod(requestContextClass,
- methodName);
+ public Method resolveRequestContextMethod(String requestContextClass, String methodName) {
+ return getNext().resolveRequestContextMethod(requestContextClass, methodName);
}
@Override
- public Class<?> resolveServiceClass(
- Class<? extends RequestContext> requestContextClass) {
+ public Class<?> resolveServiceClass(Class<? extends RequestContext> requestContextClass) {
return getNext().resolveServiceClass(requestContextClass);
}
@Override
- public Class<? extends ServiceLocator> resolveServiceLocator(
- Method contextMethod, Method domainMethod) {
+ public Class<? extends ServiceLocator> resolveServiceLocator(Method contextMethod,
+ Method domainMethod) {
return getNext().resolveServiceLocator(contextMethod, domainMethod);
}
@@ -183,8 +178,7 @@
}
@Override
- public void setProperty(Object domainObject, String property,
- Class<?> expectedType, Object value) {
+ public void setProperty(Object domainObject, String property, Class<?> expectedType, Object value) {
getNext().setProperty(domainObject, property, expectedType, value);
}
@@ -205,8 +199,7 @@
* @throws UnexpectedException this method never returns normally
* @see #report(String, Object...)
*/
- protected final <T> T die(Throwable e, String message, Object... args)
- throws UnexpectedException {
+ protected final <T> T die(Throwable e, String message, Object... args) throws UnexpectedException {
String msg = String.format(message, args);
log.log(Level.SEVERE, msg, e);
throw new UnexpectedException(msg, e);
@@ -247,8 +240,7 @@
* @throws ReportableException this method never returns normally
* @see #die(Throwable, String, Object...)
*/
- protected final <T> T report(String msg, Object... args)
- throws ReportableException {
+ protected final <T> T report(String msg, Object... args) throws ReportableException {
throw new ReportableException(String.format(msg, args));
}
diff --git a/user/src/com/google/web/bindery/requestfactory/shared/DefaultProxyStore.java b/user/src/com/google/web/bindery/requestfactory/shared/DefaultProxyStore.java
index 44dcbce..10a588a 100644
--- a/user/src/com/google/web/bindery/requestfactory/shared/DefaultProxyStore.java
+++ b/user/src/com/google/web/bindery/requestfactory/shared/DefaultProxyStore.java
@@ -57,13 +57,13 @@
* @throws IllegalArgumentException if the payload cannot be parsed
*/
public DefaultProxyStore(String payload) throws IllegalArgumentException {
- messageBean = AutoBeanCodex.decode(MessageFactoryHolder.FACTORY,
- OperationMessage.class, payload);
+ messageBean =
+ AutoBeanCodex.decode(MessageFactoryHolder.FACTORY, OperationMessage.class, payload);
OperationMessage message = messageBean.as();
if (!EXPECTED_VERSION.equals(message.getVersion())) {
- throw new IllegalArgumentException(
- "Unexpected version string in payload " + message.getVersion());
+ throw new IllegalArgumentException("Unexpected version string in payload "
+ + message.getVersion());
}
map = message.getPropertyMap();
}
diff --git a/user/src/com/google/web/bindery/requestfactory/shared/EntityProxyChange.java b/user/src/com/google/web/bindery/requestfactory/shared/EntityProxyChange.java
index ab013cb..da38463 100644
--- a/user/src/com/google/web/bindery/requestfactory/shared/EntityProxyChange.java
+++ b/user/src/com/google/web/bindery/requestfactory/shared/EntityProxyChange.java
@@ -1,12 +1,12 @@
/*
* Copyright 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -24,47 +24,45 @@
* detected. Provides a {@link WriteOperation} value describing the change, and
* the {@link EntityProxyId} of the entity in question.
* <p>
- * EntityProxyChange events are posted with the relevant EntityProxy
- * Class as their source, allowing handlers to register for changes only
- * of the type they care about via
- * {@link #registerForProxyType(EventBus, Class, Handler)}.
+ * EntityProxyChange events are posted with the relevant EntityProxy Class as
+ * their source, allowing handlers to register for changes only of the type they
+ * care about via {@link #registerForProxyType(EventBus, Class, Handler)}.
*
* @param <P> the type of the proxy
*
* @see RequestFactory#initialize(EventBus)
* @see RequestFactory#find(EntityProxyId)
*/
-public class EntityProxyChange<P extends EntityProxy> extends
- Event<EntityProxyChange.Handler<P>> {
+public class EntityProxyChange<P extends EntityProxy> extends Event<EntityProxyChange.Handler<P>> {
/**
* Implemented by methods that handle EntityProxyChange events.
- *
+ *
* @param <P> the proxy type
*/
public interface Handler<P extends EntityProxy> {
/**
* Called when an {@link EntityProxyChange} event is fired.
- *
+ *
* @param event an {@link EntityProxyChange} instance
*/
void onProxyChange(EntityProxyChange<P> event);
}
- private static final Type<EntityProxyChange.Handler<?>> TYPE = new Type<EntityProxyChange.Handler<?>>();
+ private static final Type<EntityProxyChange.Handler<?>> TYPE =
+ new Type<EntityProxyChange.Handler<?>>();
/**
* Register a handler for a EntityProxyChange events for a particular proxy
* class.
- *
+ *
* @param eventBus the {@link EventBus}
* @param proxyType a Class instance of type P
* @param handler an {@link EntityProxyChange.Handler} instance of type P
* @return an {@link EntityProxy} instance
*/
- public static <P extends EntityProxy> HandlerRegistration registerForProxyType(
- EventBus eventBus, Class<P> proxyType,
- EntityProxyChange.Handler<P> handler) {
+ public static <P extends EntityProxy> HandlerRegistration registerForProxyType(EventBus eventBus,
+ Class<P> proxyType, EntityProxyChange.Handler<P> handler) {
return eventBus.addHandlerToSource(TYPE, proxyType, handler);
}
@@ -74,7 +72,7 @@
/**
* Constructs an EntityProxyChange object.
- *
+ *
* @param proxy an {@link EntityProxy} instance of type P
* @param writeOperation a {@link WriteOperation} instance
*/
@@ -85,7 +83,7 @@
/**
* Returns the type associated with this instance.
- *
+ *
* @return an instance of {@link Event.Type Type} of type Handler<P>
*/
@SuppressWarnings({"unchecked", "rawtypes"})
@@ -102,7 +100,7 @@
/**
* Returns an unpopulated copy of the changed proxy — all properties are
* undefined except its id.
- *
+ *
* @return an instance of {@link EntityProxyId}<P>
*/
@SuppressWarnings("unchecked")
@@ -112,7 +110,7 @@
/**
* Returns the {@link WriteOperation} associated with this instance.
- *
+ *
* @return a {@link WriteOperation} instance
*/
public WriteOperation getWriteOperation() {
diff --git a/user/src/com/google/web/bindery/requestfactory/shared/LoggingRequest.java b/user/src/com/google/web/bindery/requestfactory/shared/LoggingRequest.java
index 3cdfdb3..a7c078c 100644
--- a/user/src/com/google/web/bindery/requestfactory/shared/LoggingRequest.java
+++ b/user/src/com/google/web/bindery/requestfactory/shared/LoggingRequest.java
@@ -29,9 +29,10 @@
// serialized string.
/**
* Log a message on the server.
- *
- * @param serializedLogRecordString a json serialized LogRecord, as provided by
- * {@link com.google.gwt.logging.client.JsonLogRecordClientUtil#logRecordAsJsonObject(LogRecord)}
+ *
+ * @param serializedLogRecordString a json serialized LogRecord, as provided
+ * by
+ * {@link com.google.gwt.logging.client.JsonLogRecordClientUtil#logRecordAsJsonObject(LogRecord)}
* @return a Void {@link Request}
*/
Request<Void> logMessage(String serializedLogRecordString);
diff --git a/user/src/com/google/web/bindery/requestfactory/shared/Request.java b/user/src/com/google/web/bindery/requestfactory/shared/Request.java
index 7a2edbe..5ad763d 100644
--- a/user/src/com/google/web/bindery/requestfactory/shared/Request.java
+++ b/user/src/com/google/web/bindery/requestfactory/shared/Request.java
@@ -30,14 +30,14 @@
/**
* Convenience method equivalent to calling <code>to(...).fire()</code>.
- *
+ *
* @param receiver a {@link Receiver} instance
*/
void fire(Receiver<? super T> receiver);
/**
* Specify the object that will receive the result of the method invocation.
- *
+ *
* @param receiver a {@link Receiver} instance
* @return a {@link RequestContext} instance
*/
@@ -45,7 +45,7 @@
/**
* Request additional reference properties to fetch with the return value.
- *
+ *
* @param propertyRefs a list of reference property names as Strings
* @return a {@link Request} instance of type T
*/
diff --git a/user/src/com/google/web/bindery/requestfactory/shared/RequestFactory.java b/user/src/com/google/web/bindery/requestfactory/shared/RequestFactory.java
index 71b075a..fd0f2f9 100644
--- a/user/src/com/google/web/bindery/requestfactory/shared/RequestFactory.java
+++ b/user/src/com/google/web/bindery/requestfactory/shared/RequestFactory.java
@@ -130,7 +130,8 @@
/**
* Start this request factory with a
- * {@link com.google.web.bindery.requestfactory.gwt.client.DefaultRequestTransport}.
+ * {@link com.google.web.bindery.requestfactory.gwt.client.DefaultRequestTransport}
+ * .
*
* @param eventBus an {@link EventBus}
*/
diff --git a/user/src/com/google/web/bindery/requestfactory/shared/RequestTransport.java b/user/src/com/google/web/bindery/requestfactory/shared/RequestTransport.java
index 53ba20b..4346f61 100644
--- a/user/src/com/google/web/bindery/requestfactory/shared/RequestTransport.java
+++ b/user/src/com/google/web/bindery/requestfactory/shared/RequestTransport.java
@@ -36,8 +36,8 @@
/**
* Called to report a transmission failure as a ServerFailure.
*
- * @param failure a ServerFailure instance indicating the nature
- * of the failure
+ * @param failure a ServerFailure instance indicating the nature of the
+ * failure
*/
void onTransportFailure(ServerFailure failure);
}
@@ -46,8 +46,8 @@
* Called by the RequestFactory implementation.
*
* @param payload the String payload
- * @param receiver the {@link TransportReceiver} instance that will
- * receive the payload
+ * @param receiver the {@link TransportReceiver} instance that will receive
+ * the payload
*/
void send(String payload, TransportReceiver receiver);
}
diff --git a/user/src/com/google/web/bindery/requestfactory/shared/ServerFailure.java b/user/src/com/google/web/bindery/requestfactory/shared/ServerFailure.java
index a4721fe..a4b3e56 100644
--- a/user/src/com/google/web/bindery/requestfactory/shared/ServerFailure.java
+++ b/user/src/com/google/web/bindery/requestfactory/shared/ServerFailure.java
@@ -49,8 +49,7 @@
* @param exceptionType a String containing the exception type
* @param stackTraceString a String containing the stack trace
*/
- public ServerFailure(String message, String exceptionType,
- String stackTraceString, boolean fatal) {
+ public ServerFailure(String message, String exceptionType, String stackTraceString, boolean fatal) {
this.message = message;
this.exceptionType = exceptionType;
this.stackTraceString = stackTraceString;
diff --git a/user/src/com/google/web/bindery/requestfactory/shared/ValueLocator.java b/user/src/com/google/web/bindery/requestfactory/shared/ValueLocator.java
index f32b112..50e3002 100644
--- a/user/src/com/google/web/bindery/requestfactory/shared/ValueLocator.java
+++ b/user/src/com/google/web/bindery/requestfactory/shared/ValueLocator.java
@@ -20,7 +20,7 @@
* A {@link Locator} for use with value types (as opposed to entities), which
* are not persisted. Abstract methods from the {@link Locator} class that are
* not relevant for value types are implemented to return {@code null}.
- *
+ *
* @param <T> the type of domain object the Locator will operate on
*/
public abstract class ValueLocator<T> extends Locator<T, Void> {
diff --git a/user/src/com/google/web/bindery/requestfactory/shared/package-info.java b/user/src/com/google/web/bindery/requestfactory/shared/package-info.java
index 837f728..15e0978 100644
--- a/user/src/com/google/web/bindery/requestfactory/shared/package-info.java
+++ b/user/src/com/google/web/bindery/requestfactory/shared/package-info.java
@@ -15,10 +15,11 @@
*/
/**
- * Shared classes used on both the client and the server side for transmitting data between the
- * server and the client in JSON format.
- *
+ * Shared classes used on both the client and the server side for transmitting
+ * data between the server and the client in JSON format.
+ *
* @since GWT 2.1
*/
@com.google.gwt.util.PreventSpuriousRebuilds
package com.google.web.bindery.requestfactory.shared;
+
diff --git a/user/src/com/google/web/bindery/requestfactory/vm/InProcessRequestFactory.java b/user/src/com/google/web/bindery/requestfactory/vm/InProcessRequestFactory.java
index d9129c3..78a844c 100644
--- a/user/src/com/google/web/bindery/requestfactory/vm/InProcessRequestFactory.java
+++ b/user/src/com/google/web/bindery/requestfactory/vm/InProcessRequestFactory.java
@@ -43,16 +43,13 @@
* A JRE-compatible implementation of RequestFactory.
*/
class InProcessRequestFactory extends AbstractRequestFactory {
- @Category(value = {
- EntityProxyCategory.class, ValueProxyCategory.class,
- BaseProxyCategory.class})
+ @Category(value = {EntityProxyCategory.class, ValueProxyCategory.class, BaseProxyCategory.class})
@NoWrap(EntityProxyId.class)
interface Factory extends AutoBeanFactory {
}
class RequestFactoryHandler implements InvocationHandler {
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable {
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (Object.class.equals(method.getDeclaringClass())
|| RequestFactory.class.equals(method.getDeclaringClass())) {
try {
@@ -62,22 +59,21 @@
}
}
- Class<? extends RequestContext> context = method.getReturnType().asSubclass(
- RequestContext.class);
- Dialect dialect = method.getReturnType().isAnnotationPresent(
- JsonRpcService.class) ? Dialect.JSON_RPC : Dialect.STANDARD;
- RequestContextHandler handler = new InProcessRequestContext(
- InProcessRequestFactory.this, dialect).new RequestContextHandler();
- return context.cast(Proxy.newProxyInstance(
- Thread.currentThread().getContextClassLoader(),
+ Class<? extends RequestContext> context =
+ method.getReturnType().asSubclass(RequestContext.class);
+ Dialect dialect =
+ method.getReturnType().isAnnotationPresent(JsonRpcService.class) ? Dialect.JSON_RPC
+ : Dialect.STANDARD;
+ RequestContextHandler handler =
+ new InProcessRequestContext(InProcessRequestFactory.this, dialect).new RequestContextHandler();
+ return context.cast(Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
new Class<?>[] {context}, handler));
}
}
@Override
public void initialize(EventBus eventBus) {
- throw new UnsupportedOperationException(
- "An explicit RequestTransport must be provided");
+ throw new UnsupportedOperationException("An explicit RequestTransport must be provided");
}
@Override
@@ -99,9 +95,9 @@
@SuppressWarnings("unchecked")
protected <P extends BaseProxy> Class<P> getTypeFromToken(String typeToken) {
try {
- Class<? extends BaseProxy> found = Class.forName(typeToken, false,
- Thread.currentThread().getContextClassLoader()).asSubclass(
- BaseProxy.class);
+ Class<? extends BaseProxy> found =
+ Class.forName(typeToken, false, Thread.currentThread().getContextClassLoader())
+ .asSubclass(BaseProxy.class);
return (Class<P>) found;
} catch (ClassNotFoundException e) {
return null;
diff --git a/user/src/com/google/web/bindery/requestfactory/vm/RequestFactorySource.java b/user/src/com/google/web/bindery/requestfactory/vm/RequestFactorySource.java
index 6ac518e..e893d46 100644
--- a/user/src/com/google/web/bindery/requestfactory/vm/RequestFactorySource.java
+++ b/user/src/com/google/web/bindery/requestfactory/vm/RequestFactorySource.java
@@ -41,9 +41,8 @@
*/
public static <T extends RequestFactory> T create(Class<T> requestFactory) {
RequestFactoryHandler handler = new InProcessRequestFactory().new RequestFactoryHandler();
- return requestFactory.cast(Proxy.newProxyInstance(
- Thread.currentThread().getContextClassLoader(),
- new Class<?>[] {requestFactory}, handler));
+ return requestFactory.cast(Proxy.newProxyInstance(Thread.currentThread()
+ .getContextClassLoader(), new Class<?>[] {requestFactory}, handler));
}
private RequestFactorySource() {
diff --git a/user/src/com/google/web/bindery/requestfactory/vm/package-info.java b/user/src/com/google/web/bindery/requestfactory/vm/package-info.java
index f78d89f..95e93f2 100644
--- a/user/src/com/google/web/bindery/requestfactory/vm/package-info.java
+++ b/user/src/com/google/web/bindery/requestfactory/vm/package-info.java
@@ -15,9 +15,11 @@
*/
/**
- * Classes to use RequestFactory in a non-GWT (e.g., Android or desktop) JRE environment.
- *
+ * Classes to use RequestFactory in a non-GWT (e.g., Android or desktop) JRE
+ * environment.
+ *
* @since GWT 2.3
*/
@com.google.gwt.util.PreventSpuriousRebuilds
package com.google.web.bindery.requestfactory.vm;
+