public SetterFieldImpl(Class containerClass, String propertyName, Field field) { this.containerClass = containerClass; this.propertyName = propertyName; this.field = field; this.setterMethod = ReflectHelper.setterMethodOrNull( containerClass, propertyName, field.getType() ); }
public static Method findSetterMethod(final Class containerClass, final String propertyName, final Class propertyType) { final Method setter = setterMethodOrNull( containerClass, propertyName, propertyType ); if ( setter == null ) { throw new PropertyNotFoundException( String.format( Locale.ROOT, "Could not locate setter method for property [%s#%s]", containerClass.getName(), propertyName ) ); } return setter; }
@Override protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException { try { String stringValue = javaTypeDescriptor.unwrap( value, String.class, options ); Class clazz= ReflectHelper.classForName( "org.postgresql.util.PGobject", this.getClass()); Object holder = clazz.newInstance(); ReflectHelper.setterMethodOrNull( clazz, "type", String.class ).invoke( holder, "inet" ); ReflectHelper.setterMethodOrNull( clazz, "value", String.class ).invoke( holder, stringValue ); st.setObject( index, holder ); } catch (ClassNotFoundException|IllegalAccessException|InstantiationException|InvocationTargetException e) { throw new IllegalArgumentException( e ); } }
); Method setterMethod = setterMethodOrNull( containerJavaType, propertyName, getterMethod.getReturnType() );
public SetterFieldImpl(Class containerClass, String propertyName, Field field) { this.containerClass = containerClass; this.propertyName = propertyName; this.field = field; this.setterMethod = ReflectHelper.setterMethodOrNull( containerClass, propertyName, field.getType() ); }
public static Method findSetterMethod(final Class containerClass, final String propertyName, final Class propertyType) { final Method setter = setterMethodOrNull( containerClass, propertyName, propertyType ); if ( setter == null ) { throw new PropertyNotFoundException( String.format( Locale.ROOT, "Could not locate setter method for property [%s#%s]", containerClass.getName(), propertyName ) ); } return setter; }
); Method setterMethod = setterMethodOrNull( containerJavaType, propertyName, getterMethod.getReturnType() );