@Test public void shouldFoundAGetter() throws Exception { final House aSimpleJavaBeans = new House(); final List<Method> methodsOfHouseClass = Arrays.asList(House.class.getMethods()); Method foundMethod = new ReflectionBasedNullHandler(proxifier).findGetter(aSimpleJavaBeans, "Mouse"); assertThat(methodsOfHouseClass, hasItem(foundMethod)); assertTrue(Mouse.class.isAssignableFrom(foundMethod.getReturnType())); assertThat(foundMethod.getName(), is(startsWith("getMouse"))); }
Method findGetter(Object target, String propertyCapitalized) { Class<? extends Object> targetClass = target.getClass(); if (proxifier.isProxy(target)) { targetClass = targetClass.getSuperclass(); } return new Mirror().on(targetClass).reflect().method("get" + propertyCapitalized).withoutArgs(); }
ReflectionBasedNullHandler extends ObjectNullHandler { Method findGetter(Object target, String propertyCapitalized) { Class<? extends Object> targetClass = target.getClass(); if (proxifier.isProxy(target)) { targetClass = targetClass.getSuperclass(); } return new Mirror().on(targetClass).reflect().method("get" + propertyCapitalized).withoutArgs(); } }
ReflectionBasedNullHandler extends ObjectNullHandler { Method findGetter(Object target, String propertyCapitalized) { Class<? extends Object> targetClass = target.getClass(); if (proxifier.isProxy(target)) { targetClass = targetClass.getSuperclass(); } return new Mirror().on(targetClass).reflect().method("get" + propertyCapitalized).withoutArgs(); } ReflectionBasedNullHandler(Proxifier proxifier); }
ReflectionBasedNullHandler extends ObjectNullHandler { Method findGetter(Object target, String propertyCapitalized) { Class<? extends Object> targetClass = target.getClass(); if (proxifier.isProxy(target)) { targetClass = targetClass.getSuperclass(); } return new Mirror().on(targetClass).reflect().method("get" + propertyCapitalized).withoutArgs(); } ReflectionBasedNullHandler(Proxifier proxifier); @Override Object nullPropertyValue(Map context, Object target, Object property); }
ReflectionBasedNullHandler extends ObjectNullHandler { Method findGetter(Object target, String propertyCapitalized) { Class<? extends Object> targetClass = target.getClass(); if (proxifier.isProxy(target)) { targetClass = targetClass.getSuperclass(); } return new Mirror().on(targetClass).reflect().method("get" + propertyCapitalized).withoutArgs(); } ReflectionBasedNullHandler(Proxifier proxifier); @Override Object nullPropertyValue(Map context, Object target, Object property);  }