@ SuppressWarnings ( "unchecked" ) public static Method findSetter ( String propertyName , Class entityClass , Class valueType ) { Method setter ; String setterName = "set" + propertyName . substring ( 0 , 1 ) . toUpperCase ( ) + propertyName . substring ( 1 ) ; try { setter = entityClass . getMethod ( setterName , valueType ) ; } catch ( NoSuchMethodException e ) { // let's try with scala setter name try { setter = entityClass . getMethod ( propertyName + "_$eq" , valueType ) ; } catch ( NoSuchMethodException e1 ) { throw new DeepIOException ( e1 ) ; } } return setter ; }
Resolves the setter name for the property whose name is propertyName whose type is valueType in the entity bean whose class is entityClass . If we don t find a setter following Java s naming conventions before throwing an exception we try to resolve the setter following Scala s naming conventions .