Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.skife.jdbi.v2.sqlobject;
 
 
 
class BindBeanFactory implements BinderFactory
    public Binder build(Annotation annotation)
    {
        return new Binder<BindBeanObject>()
        {
            public void bind(SQLStatement qBindBean bindObject arg)
            {
                final String prefix;
                if ("___jdbi_bare___".equals(bind.value())) {
                    prefix = "";
                }
                else {
                    prefix = bind.value() + ".";
                }
                try {
                    BeanInfo infos = Introspector.getBeanInfo(arg.getClass());
                    PropertyDescriptor[] props = infos.getPropertyDescriptors();
                    for (PropertyDescriptor prop : props) {
                        q.bind(prefix + prop.getName(), prop.getReadMethod().invoke(arg));
                    }
                }
                catch (Exception e) {
                    throw new IllegalStateException("unable to bind bean properties"e);
                }
            }
        };
    }
New to GrepCode? Check out our FAQ X