code: public static byte[] toBytes(Object value) {
          if (value == null) {
              return null;
          } else if (value instanceof byte[]) {
              return (byte[]) value;
          } else if (value instanceof Blob) {
              return toBytes((Blob) value);
          } else {
              return toString(value).getBytes();
          }
      }
  
      /**
       * Converts <code>java.sql.Blob</code> to bytes array.
       *
       * @param blob Blob to be converted
       * @return blob converted to byte array
       */
      public static byte[] toBytes(Blob blob) {
          InputStream is = null;
          try {
              is = blob.getBinaryStream();
              return bytes(is);
          } catch (Exception e) {
              throw new ConversionException(e);
          } finally {
              closeQuietly(is);
          }
      }
  
      /**
       * Converts value to Short if it can. If value is a Short, it is returned, if it is a Number, it is
       * promoted to Short and then returned, in all other cases, it converts the value to String,
       * then tries to parse Short from it.
       *
       * @param value value to be converted to Integer.
       * @return value converted to Integer.
       */
      public static Short toShort(Object value) {
          if (value == null) {
              return null;
          } else if (value instanceof Short) {
              return (Short) value;
          } else if (value instanceof Number) {
              return ((Number) value).shortValue();
          } else {
              try {
                  return Short.valueOf(value.toString().trim());
              } catch (NumberFormatException e) {
                  throw new ConversionException("failed to convert: '" + value + "' to Short", e);
              }
          }
      }
docs: Converts value to bytes array if it can. If the value is byte array, it is simply returned,
  if it is a <code>java.sql.Blob</code>, then data is read from it as bytes.
  In all other cases the object is converted to <code>String</code>, then bytes are read from it.
  
  @param value value to be converted.
  @return value converted to byte array.