@Test public void testHandleVariableLookupArrayParam() { DataRow parameters = mock( DataRow.class ); doReturn( new Object[] { "val_0", 10, "test_val" } ).when( parameters ).get( "column_name" ); StringBuilder result = new StringBuilder(); parser.handleVariableLookup( result, parameters, "column_name" ); assertThat( result.toString(), is( equalTo( "?,?,?" ) ) ); }
protected void handleVariableLookup( final StringBuilder result, final DataRow parameters, final String columnName ) { if ( parameters == null ) { throw new NullPointerException( "Parameters must never be null" ); } final String s = lookupVariable( columnName ); final Object propertyValue = parameters.get( columnName ); if ( expandArray && propertyValue instanceof Object[] ) { final Object[] parameterValues = (Object[]) propertyValue; for ( int j = 0; j < parameterValues.length - 1; j++ ) { result.append( s ); result.append( ',' ); } result.append( s ); } else { result.append( s ); } }
SQLParameterLookupParser extends PropertyLookupParser { protected void handleVariableLookup( final StringBuilder result, final DataRow parameters, final String columnName ) { if ( parameters == null ) { throw new NullPointerException( "Parameters must never be null" ); } final String s = lookupVariable( columnName ); final Object propertyValue = parameters.get( columnName ); if ( expandArray && propertyValue instanceof Object[] ) { final Object[] parameterValues = (Object[]) propertyValue; for ( int j = 0; j < parameterValues.length - 1; j++ ) { result.append( s ); result.append( ',' ); } result.append( s ); } else { result.append( s ); } } }
SQLParameterLookupParser extends PropertyLookupParser { protected void handleVariableLookup( final StringBuilder result, final DataRow parameters, final String columnName ) { if ( parameters == null ) { throw new NullPointerException( "Parameters must never be null" ); } final String s = lookupVariable( columnName ); final Object propertyValue = parameters.get( columnName ); if ( expandArray && propertyValue instanceof Object[] ) { final Object[] parameterValues = (Object[]) propertyValue; for ( int j = 0; j < parameterValues.length - 1; j++ ) { result.append( s ); result.append( ',' ); } result.append( s ); } else { result.append( s ); } } SQLParameterLookupParser( final boolean expandArray ); }
SQLParameterLookupParser extends PropertyLookupParser { protected void handleVariableLookup( final StringBuilder result, final DataRow parameters, final String columnName ) { if ( parameters == null ) { throw new NullPointerException( "Parameters must never be null" ); } final String s = lookupVariable( columnName ); final Object propertyValue = parameters.get( columnName ); if ( expandArray && propertyValue instanceof Object[] ) { final Object[] parameterValues = (Object[]) propertyValue; for ( int j = 0; j < parameterValues.length - 1; j++ ) { result.append( s ); result.append( ',' ); } result.append( s ); } else { result.append( s ); } } SQLParameterLookupParser( final boolean expandArray ); String[] getFields(); boolean isExpandArray(); }
SQLParameterLookupParser extends PropertyLookupParser { protected void handleVariableLookup( final StringBuilder result, final DataRow parameters, final String columnName ) { if ( parameters == null ) { throw new NullPointerException( "Parameters must never be null" ); } final String s = lookupVariable( columnName ); final Object propertyValue = parameters.get( columnName ); if ( expandArray && propertyValue instanceof Object[] ) { final Object[] parameterValues = (Object[]) propertyValue; for ( int j = 0; j < parameterValues.length - 1; j++ ) { result.append( s ); result.append( ',' ); } result.append( s ); } else { result.append( s ); } } SQLParameterLookupParser( final boolean expandArray ); String[] getFields(); boolean isExpandArray();  }