private static boolean tryToSetValueThroughSetter ( OpenEngSBModelEntry entry , Object instance ) throws IllegalAccessException { try { String setterName = getSetterName ( entry . getKey ( ) ) ; Method method = instance . getClass ( ) . getMethod ( setterName , entry . getType ( ) ) ; method . invoke ( instance , entry . getValue ( ) ) ; return true ; } catch ( NoSuchMethodException e ) { // if there exist no such method, then it is an entry meant for the model tail } catch ( IllegalArgumentException e ) { LOGGER . error ( "IllegalArgumentException while trying to set values for the new model." , e ) ; } catch ( InvocationTargetException e ) { LOGGER . error ( "InvocationTargetException while trying to set values for the new model." , e ) ; } return false ; }
Tries to set the value of an OpenEngSBModelEntry to its corresponding setter of the model . Returns true if the setter can be called returns false if not .