avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexandre Normand (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-1368) String schema accepts any Java object, and converts it with toString()
Date Tue, 27 Aug 2013 19:14:52 GMT

    [ https://issues.apache.org/jira/browse/AVRO-1368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13751608#comment-13751608
] 

Alexandre Normand commented on AVRO-1368:
-----------------------------------------

Can you do this in {{SpecificDatumWriter#writeString()}} instead?
{code}
  @Override
  protected void writeString(Schema schema, Object datum, Encoder out)
    throws IOException {
    if (!(datum instanceof CharSequence) && SpecificData.get().isStringable(datum.getClass()))
        // Stringable
      datum = datum.toString();                                                          
             // call toString()
    writeString(datum, out);
  }
{code}
                
> String schema accepts any Java object, and converts it with toString()
> ----------------------------------------------------------------------
>
>                 Key: AVRO-1368
>                 URL: https://issues.apache.org/jira/browse/AVRO-1368
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.5
>            Reporter: Christophe Taton
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message