}
}
else if (fieldable instanceof Field) {
Field safeField = (Field) fieldable;
if ( safeField.isBinary() ) {
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 new SearchException( "Conversion from Reader to String not yet implemented" );
}
else if ( safeField.tokenStreamValue() != null ) {
serializer.addFieldWithTokenStreamData( new LuceneFieldContext( safeField ) );
}
else {
throw new SearchException( "Unknown value type for Field: " + safeField );
}
}