@Test(expected = NullPointerException.class) public void testFindSetterWithNullFieldType() { findSetter(bean, "name", null); }
public static Method findSetter(final Object object, final String fieldName, final Class<?> argumentType) { if( object == null ) { throw new NullPointerException("object should not be null"); } else if( fieldName == null ) { throw new NullPointerException("fieldName should not be null"); } else if( argumentType == null ) { throw new NullPointerException("argumentType should not be null"); } final String setterName = getMethodNameForField(SET_PREFIX, fieldName); final Class<?> clazz = object.getClass(); Method setter = findSetterWithCompatibleParamType(clazz, setterName, argumentType); if( setter == null && AUTOBOXING_CONVERTER.containsKey(argumentType) ) { setter = findSetterWithCompatibleParamType(clazz, setterName, AUTOBOXING_CONVERTER.get(argumentType)); } if( setter == null ) { throw new SuperCsvReflectionException( String .format( "unable to find method %s(%s) in class %s - check that the corresponding nameMapping element matches the field name in the bean, " + "and the cell processor returns a type compatible with the field", setterName, argumentType.getName(), clazz.getName())); } return setter; }
ReflectionUtils { public static Method findSetter(final Object object, final String fieldName, final Class<?> argumentType) { if( object == null ) { throw new NullPointerException("object should not be null"); } else if( fieldName == null ) { throw new NullPointerException("fieldName should not be null"); } else if( argumentType == null ) { throw new NullPointerException("argumentType should not be null"); } final String setterName = getMethodNameForField(SET_PREFIX, fieldName); final Class<?> clazz = object.getClass(); Method setter = findSetterWithCompatibleParamType(clazz, setterName, argumentType); if( setter == null && AUTOBOXING_CONVERTER.containsKey(argumentType) ) { setter = findSetterWithCompatibleParamType(clazz, setterName, AUTOBOXING_CONVERTER.get(argumentType)); } if( setter == null ) { throw new SuperCsvReflectionException( String .format( "unable to find method %s(%s) in class %s - check that the corresponding nameMapping element matches the field name in the bean, " + "and the cell processor returns a type compatible with the field", setterName, argumentType.getName(), clazz.getName())); } return setter; } }
ReflectionUtils { public static Method findSetter(final Object object, final String fieldName, final Class<?> argumentType) { if( object == null ) { throw new NullPointerException("object should not be null"); } else if( fieldName == null ) { throw new NullPointerException("fieldName should not be null"); } else if( argumentType == null ) { throw new NullPointerException("argumentType should not be null"); } final String setterName = getMethodNameForField(SET_PREFIX, fieldName); final Class<?> clazz = object.getClass(); Method setter = findSetterWithCompatibleParamType(clazz, setterName, argumentType); if( setter == null && AUTOBOXING_CONVERTER.containsKey(argumentType) ) { setter = findSetterWithCompatibleParamType(clazz, setterName, AUTOBOXING_CONVERTER.get(argumentType)); } if( setter == null ) { throw new SuperCsvReflectionException( String .format( "unable to find method %s(%s) in class %s - check that the corresponding nameMapping element matches the field name in the bean, " + "and the cell processor returns a type compatible with the field", setterName, argumentType.getName(), clazz.getName())); } return setter; } private  ReflectionUtils(); }
ReflectionUtils { public static Method findSetter(final Object object, final String fieldName, final Class<?> argumentType) { if( object == null ) { throw new NullPointerException("object should not be null"); } else if( fieldName == null ) { throw new NullPointerException("fieldName should not be null"); } else if( argumentType == null ) { throw new NullPointerException("argumentType should not be null"); } final String setterName = getMethodNameForField(SET_PREFIX, fieldName); final Class<?> clazz = object.getClass(); Method setter = findSetterWithCompatibleParamType(clazz, setterName, argumentType); if( setter == null && AUTOBOXING_CONVERTER.containsKey(argumentType) ) { setter = findSetterWithCompatibleParamType(clazz, setterName, AUTOBOXING_CONVERTER.get(argumentType)); } if( setter == null ) { throw new SuperCsvReflectionException( String .format( "unable to find method %s(%s) in class %s - check that the corresponding nameMapping element matches the field name in the bean, " + "and the cell processor returns a type compatible with the field", setterName, argumentType.getName(), clazz.getName())); } return setter; } private  ReflectionUtils(); static Method findGetter(final Object object, final String fieldName); static Method findSetter(final Object object, final String fieldName, final Class<?> argumentType); }
ReflectionUtils { public static Method findSetter(final Object object, final String fieldName, final Class<?> argumentType) { if( object == null ) { throw new NullPointerException("object should not be null"); } else if( fieldName == null ) { throw new NullPointerException("fieldName should not be null"); } else if( argumentType == null ) { throw new NullPointerException("argumentType should not be null"); } final String setterName = getMethodNameForField(SET_PREFIX, fieldName); final Class<?> clazz = object.getClass(); Method setter = findSetterWithCompatibleParamType(clazz, setterName, argumentType); if( setter == null && AUTOBOXING_CONVERTER.containsKey(argumentType) ) { setter = findSetterWithCompatibleParamType(clazz, setterName, AUTOBOXING_CONVERTER.get(argumentType)); } if( setter == null ) { throw new SuperCsvReflectionException( String .format( "unable to find method %s(%s) in class %s - check that the corresponding nameMapping element matches the field name in the bean, " + "and the cell processor returns a type compatible with the field", setterName, argumentType.getName(), clazz.getName())); } return setter; } private  ReflectionUtils(); static Method findGetter(final Object object, final String fieldName); static Method findSetter(final Object object, final String fieldName, final Class<?> argumentType); static final String SET_PREFIX; static final String GET_PREFIX; static final String IS_PREFIX; }