@Deprecated(forRemoval=true, since = "13.0")
   public static byte[] convertJavaToText(Object source, MediaType sourceMediaType, MediaType destinationMediaType) {
      if (source == null) return null;
      if (sourceMediaType == null || destinationMediaType == null) {
         throw new NullPointerException("sourceMediaType and destinationMediaType cannot be null!");
      }
      Object decoded = decodeObjectContent(source, sourceMediaType);

      if (decoded instanceof byte[]) {
         return convertCharset(source, StandardCharsets.UTF_8, destinationMediaType.getCharset());
      } else {
         String asString = decoded.toString();
         return asString.getBytes(destinationMediaType.getCharset());
      }
   }
@Test
   public void testJavaToTextConversion() {
      String string = "I've seen things you people wouldn't believe.";
      Double number = 12.1d;
      Calendar complex = Calendar.getInstance();

      MediaType stringType = APPLICATION_OBJECT.withParameter("type", "java.lang.String");
      byte[] result1 = StandardConversions.convertJavaToText(string, stringType, TEXT_PLAIN.withCharset(UTF_16BE));
      assertArrayEquals(string.getBytes(UTF_16BE), result1);

      MediaType doubleType = APPLICATION_OBJECT.withParameter("type", "java.lang.Double");
      byte[] result2 = StandardConversions.convertJavaToText(number, doubleType, TEXT_PLAIN.withCharset(US_ASCII));
      assertArrayEquals("12.1".getBytes(US_ASCII), result2);

      MediaType customType = APPLICATION_OBJECT.withParameter("type", complex.getClass().getName());
      byte[] bytes = StandardConversions.convertJavaToText(complex, customType, TEXT_PLAIN.withCharset(US_ASCII));
      assertEquals(complex.toString(), new String(bytes));
   }