@Test(expected = NullPointerException.class) public void testGetSetMethodWithNullObject() { cache.getSetMethod(null, "name", String.class); }
public <T> Method getSetMethod(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"); } Method method = setMethodsCache.get(object.getClass(), argumentType, fieldName); if( method == null ) { method = ReflectionUtils.findSetter(object, fieldName, argumentType); setMethodsCache.set(object.getClass(), argumentType, fieldName, method); } return method; }
MethodCache { public <T> Method getSetMethod(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"); } Method method = setMethodsCache.get(object.getClass(), argumentType, fieldName); if( method == null ) { method = ReflectionUtils.findSetter(object, fieldName, argumentType); setMethodsCache.set(object.getClass(), argumentType, fieldName, method); } return method; } }
MethodCache { public <T> Method getSetMethod(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"); } Method method = setMethodsCache.get(object.getClass(), argumentType, fieldName); if( method == null ) { method = ReflectionUtils.findSetter(object, fieldName, argumentType); setMethodsCache.set(object.getClass(), argumentType, fieldName, method); } return method; }  }
MethodCache { public <T> Method getSetMethod(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"); } Method method = setMethodsCache.get(object.getClass(), argumentType, fieldName); if( method == null ) { method = ReflectionUtils.findSetter(object, fieldName, argumentType); setMethodsCache.set(object.getClass(), argumentType, fieldName, method); } return method; }  Method getGetMethod(final Object object, final String fieldName); Method getSetMethod(final Object object, final String fieldName, final Class<?> argumentType); }
MethodCache { public <T> Method getSetMethod(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"); } Method method = setMethodsCache.get(object.getClass(), argumentType, fieldName); if( method == null ) { method = ReflectionUtils.findSetter(object, fieldName, argumentType); setMethodsCache.set(object.getClass(), argumentType, fieldName, method); } return method; }  Method getGetMethod(final Object object, final String fieldName); Method getSetMethod(final Object object, final String fieldName, final Class<?> argumentType);  }