}
public static VirtualDocumentResolver[] parseVirtualDocumentResolver( final String[] virtualDocumentSpec, final int[] indexedField, final DocumentFactory factory ) {
final VirtualDocumentResolver[] virtualDocumentResolver = new VirtualDocumentResolver[ indexedField.length ];
VirtualDocumentResolver defaultResolver = null;
IntArrayList indexedFields = IntArrayList.wrap( indexedField );
for ( int i = 0; i < virtualDocumentSpec.length; i++ )
if ( virtualDocumentSpec[ i ].indexOf( ':' ) == -1 ) try {
defaultResolver = (VirtualDocumentResolver)BinIO.loadObject( virtualDocumentSpec[ i ] );
}
catch ( IOException e ) {
throw new RuntimeException( "An I/O error occurred while loading " + virtualDocumentSpec[ i ], e );
}
catch ( ClassNotFoundException e ) {
throw new RuntimeException( "Cannot load " + virtualDocumentSpec[ i ], e );
}
for ( int i = 0; i < virtualDocumentResolver.length; i++ )
virtualDocumentResolver[ i ] = defaultResolver;
for ( int i = 0; i < virtualDocumentSpec.length; i++ ) {
final int split = virtualDocumentSpec[ i ].indexOf( ':' );
if ( split >= 0 ) {
final String fieldName = virtualDocumentSpec[ i ].substring( 0, split );
final int field = factory.fieldIndex( fieldName );
if ( field < 0 ) throw new IllegalArgumentException( "Field " + fieldName + " is not part of factory " + factory.getClass().getName() );
if ( !indexedFields.contains( field ) ) throw new IllegalArgumentException( "Field " + factory.fieldName( field ) + " is not being indexed" );
if ( factory.fieldType( field ) != DocumentFactory.FieldType.VIRTUAL ) throw new IllegalArgumentException( "Field " + factory.fieldName( field ) + " is not virtual" );
try {
virtualDocumentResolver[ indexedFields.indexOf( field ) ] = (VirtualDocumentResolver)BinIO.loadObject( virtualDocumentSpec[ i ].substring( split + 1 ) );
}
catch ( IOException e ) {
throw new RuntimeException( "An I/O error occurred while loading " + virtualDocumentSpec[ i ].substring( split + 1 ), e );
}
catch ( ClassNotFoundException e ) {