Web Service Connector (WSC) and Duplicate boolean Getters

If you have worked with Salesforce WebService API or Metadata API from within Java environment, then it is possible that you might have used Salesforce WSC. This is a all inclusive high performance WebService stack, designed to access the Salesforce APIs easily.

I have been using that for a tool I have been working on and it has been working great.

One issue I found with this library is that it generates two getters for boolean variables (Both get and is variant). Some tools (like Jackson) doesn’t like this fact and complain about it.

org.codehaus.jackson.map.JsonMappingException: Conflicting getter definitions for property "booleanVariable"

Fortunately, it is easy fix this issue. WSC uses templates to generate the Java files. These templates are there in com.sforce.ws.tools. Template which generates the type source files is type.template. In this template, replace the following,

public <%=gen.javaType(el)%> <%=gen.getMethod(el)%>() {
    return <%=gen.fieldName(el)%>;
}

with

<% if(!"boolean".equals(gen.javaType(el))) { %>
  public <%=gen.javaType(el)%> <%=gen.getMethod(el)%>() {
    return <%=gen.fieldName(el)%>;
  }
  <% }/**end if()*/%>

This should avoid generating the duplicate getters for boolean variables.

Enhanced service from Servers

You might have experienced this. You want to see an article in some site. When you navigate using your smart phone to read the article, instead of showing the article, site would show you the mobile version of their home page with assumption that they are providing you the enhanced service :). It just freaks me out and I wonder why they do that.

Well, Xkcd, says it well.

Hi I'm a Server

Cricket World Cup 2011 – Chrome Extension

If you know the Cricket game, you would sure to be aware of the on going Cricket World Cup 2011 hosted by India, Bangladesh and Sri Lanka.

Usually Google Chrome team releases a extension to make it easy for people to see the details like Fixtures, Teams etc. But not sure why, they haven’t done anything like it this year.

So I thought of writing an extension to do just that. And here is first version. Cricket World Cup 2011

Take a look, try it and let me know what you think (you can post comments in the chrome page itself). If you like it, don’t forget to rate it as you feel appropriate.