code: public Object encode(Object o) {
          if(o instanceof String) {
              // create a new copy of the String instance            
              return new String((String)o);
          } else if(o instanceof CharSequence) {
              // convert CharSequence to String so that we have a new instance
              return String.valueOf(o);
          } else {
              return o;
          }
      }
docs: /* (non-Javadoc)
  @see Encoder#encode(java.lang.Object)