Source:
<code>public Optional<Argument> find(String name, StatementContext ctx) { if (name.startsWith(prefix)) { String propertyName = name.substring(prefix.length()); for (PropertyDescriptor descriptor : info.getPropertyDescriptors()) { if (propertyName.equals(descriptor.getName())) { Method getter = descriptor.getReadMethod(); if (getter == null) { throw new UnableToCreateStatementException(String.format("No getter method found for " + "bean property [%s] on [%s]", propertyName, bean), ctx); } try { Type propertyType = getter.getGenericReturnType(); Object propertyValue = getter.invoke(bean); Optional<Argument> argument = ctx.findArgumentFor(propertyType, propertyValue); if (!argument.isPresent()) { throw new UnableToCreateStatementException( String.format("No argument factory registered for type [%s] for bean property [%s] on [%s]", propertyType, propertyName, bean), ctx); } return argument; } catch (IllegalAccessException e) { throw new UnableToCreateStatementException(String.format("Access exception invoking getter for " + "bean property [%s] on [%s]", propertyName, bean), e, ctx); } catch (InvocationTargetException e) { throw new UnableToCreateStatementException(String.format("Invocation target exception invoking " + "getter for bean property [%s] on [%s]", propertyName, bean), e, ctx); } } } try { for (Field field : bean.getClass().getFields()) { <START> if (Modifier.isPublic(field.getModifiers()) && field.getName().equals(propertyName)) <END> { Object fieldValue = field.get(bean); Optional<Argument> argument = ctx.findArgumentFor(field.getGenericType(), fieldValue); if (argument.isPresent()) { return argument; } } } } catch (IllegalAccessException e) { throw new UnableToCreateStatementException(String.format("Access exception getting field for " + "bean property [%s] on [%s]", propertyName, bean), e, ctx); } } return Optional.empty(); }</code><technical_language>I Class.getFields() returns public fields</technical_language>

Target:
public Optional<Argument> find(String name, StatementContext ctx) { if (name.startsWith(prefix)) { String propertyName = name.substring(prefix.length()); for (PropertyDescriptor descriptor : info.getPropertyDescriptors()) { if (propertyName.equals(descriptor.getName())) { Method getter = descriptor.getReadMethod(); if (getter == null) { throw new UnableToCreateStatementException(String.format("No getter method found for " + "bean property [%s] on [%s]", propertyName, bean), ctx); } try { Type propertyType = getter.getGenericReturnType(); Object propertyValue = getter.invoke(bean); Optional<Argument> argument = ctx.findArgumentFor(propertyType, propertyValue); if (!argument.isPresent()) { throw new UnableToCreateStatementException( String.format("No argument factory registered for type [%s] for bean property [%s] on [%s]", propertyType, propertyName, bean), ctx); } return argument; } catch (IllegalAccessException e) { throw new UnableToCreateStatementException(String.format("Access exception invoking getter for " + "bean property [%s] on [%s]", propertyName, bean), e, ctx); } catch (InvocationTargetException e) { throw new UnableToCreateStatementException(String.format("Invocation target exception invoking " + "getter for bean property [%s] on [%s]", propertyName, bean), e, ctx); } } } try { for (Field field : bean.getClass().getFields()) { if (field.getName().equals(propertyName)) { Object fieldValue = field.get(bean); Type fieldType = field.getGenericType(); Optional<Argument> argument = ctx.findArgumentFor(fieldType, fieldValue); if (!argument.isPresent()) { throw new UnableToCreateStatementException( String.format("No argument factory registered for type [%s] for field [%s] on [%s]", fieldType, propertyName, bean), ctx); } return argument; } } } catch (IllegalAccessException e) { throw new UnableToCreateStatementException(String.format("Access exception getting field for " + "bean property [%s] on [%s]", propertyName, bean), e, ctx); } } return Optional.empty(); }