code: @SuppressWarnings({ "rawtypes", "unchecked"})
    public static byte[] encode(final String attributeName, final Object obj) {
      TypeConverter converter = DataConverter.attributeConverters
          .get(attributeName);
      if (converter == null) {
        log.warn(
            "Unable to find a suitable data converter for attribute {}.",
            attributeName);
        throw new IllegalArgumentException(
            "Unable to find a suitable data converter for attribute \""
                + attributeName + "\".");
      }
  
      if (obj instanceof String) {
        return converter.encode((String) obj);
      }
      return converter.encode(obj);
    }
docs: Encodes attribute data into the standard binary representation for the
  type.
  @param attributeName the name of the attribute
  @param obj the object to encode
  @return the encoded form of the object as a byte[].