else if (fieldable instanceof Field) {
Field safeField = (Field) fieldable;
//FIXME it seems like in new Field implementation it's possible to have multiple data types at the same time. Investigate?
//The following sequence of else/ifs would not be appropriate.
if ( safeField.binaryValue() != null ) {
serializer.addFieldWithBinaryData( new LuceneFieldContext( safeField ) );
}
else if ( safeField.stringValue() != null ) {
serializer.addFieldWithStringData( new LuceneFieldContext( safeField ) );
}
else if ( safeField.readerValue() != null && safeField.readerValue() instanceof Serializable ) {
serializer.addFieldWithSerializableReaderData( new LuceneFieldContext( safeField ) );
}
else if ( safeField.readerValue() != null ) {
throw log.conversionFromReaderToStringNotYetImplemented();
}
else if ( safeField.tokenStreamValue() != null ) {
serializer.addFieldWithTokenStreamData( new LuceneFieldContext( safeField ) );
}
else {
throw log.unknownFieldType( safeField.getClass() );
}
}