A DeobfuscatorBuilder must be named the same as your RequestFactory (including same package) suffixed with "DeobfuscatorBuilder", and extend com.google.web.bindery.requestfactory.vm.impl.Deobfuscator.Builder.
The ones generated by the ValidationTool/annotation processor initialize themselves in the
instance initializer. but you could do the same in the constructor. Initialization is made in three parts:
- withOperation: registers service methods
- withRawTypeToken: registers each proxy with their type token
- withClientToDomainMappings: registers the mappings between domain classes and proxies, i.e. domain-to-client (sic!)
Ex:
withOperation(new OperationKey("<token>"),
new OperationData.Builder()
.withClientMethodDescriptor("(<JNI descriptor for method arguments>)<JNI descriptor for return type; Request or InstanceRequest>")
.withDomainMethodDescriptor("<similar, but for the corresponding domain method>")
.withMethodName("…")
.withRequestContext("…")
.build());
The OperationKey can be built either with the token directly or the RequestContext binary name, method name and client method descriptor (the exact same arguments you'll pass to withRequestContext, withMethodName and withClientMethodDescriptor). For instance, I compute the token (using the 3-args ctor and then a call to get(): new OperationKey(contextBinaryName, methodName, methodDescriptor).get()) at the time I generate the DeobfuscatorBuilder.
withRawTypeToken("<token>", "<proxy binary name>";
The token is computed using OperationKey.hash("<proxy binary name>").
withClientToDomainMapping("<domain class binary name>", Arrays.asList("<proxy binary name>", "<another proxy binary name if needed>"));
Note that, in the DeobfuscatorBuilder generated by the ValidationTool/annotation processor, the BaseProxy, ValueProxy and EntityProxy do have their withRawTypeToken, and the latter two are listed as client types for java.lang.Object in withClienttoDomainMapping. So you'll have at a minimum:
withRawTypeToken("FXHD5YU0TiUl3uBaepdkYaowx9k=", "com.google.web.bindery.requestfactory.shared.BaseProxy");
withRawTypeToken("w1Qg$YHpDaNcHrR5HZ$23y518nA=", "com.google.web.bindery.requestfactory.shared.EntityProxy");
withRawTypeToken("8KVVbwaaAtl6KgQNlOTsLCp9TIU=", "com.google.web.bindery.requestfactory.shared.ValueProxy");
withClientToDomainMappings("java.lang.Object", Arrays.asList("com.google.web.bindery.requestfactory.shared.EntityProxy","com.google.web.bindery.requestfactory.shared.ValueProxy"));
An "echo" method could be:
withOperation(new OperationKey("com.example.shared.EchoContext", "echo", "(Ljava/lang/String;)Lcom/google/web/bindery/requestfactory/shared/Request;"),
new OperationData.Builder()
.withClientMethodDescriptor("(Ljava/lang/String;)Lcom/google/web/bindery/requestfactory/shared/Request;")
.withDomainMethodDescriptor("(Ljava/lang/String;)Ljava/lang/String;")
.withMethodName("echo")
.withRequestContext("com.example.shared.EchoContext")
.build());
But as I said, in your case, annotating the property with @SkipInterfaceValidation should be enough, and the ValidationTool/annotation processor will then generate the DeobfuscatorBuilder (because it won't check the domain class for that property). And it should work at runtime because properties are resolved by name, they're not obfuscated.