@Test public void testReadValue() { TestObject testObject = new TestObject(); PropertyAccessDescriptor<TestObject, Long> descriptor = new PropertyAccessDescriptor<>(TestObject.class, TestObject.READ_ONLY_LONG_PROPERTY); ReadMethod<TestObject, Long> readMethod = descriptor.createReadMethod(); assertEquals(42, readMethod.readValue(testObject).longValue()); }
public V readValue(T boundObject) { if (canRead()) { return readValueWithExceptionHandling(boundObject); } else { throw new IllegalStateException( "Cannot find getter method for " + boundObject.getClass().getName() + "#" + getPropertyName()); } }
ReadMethod extends AbstractMethod<T> { public V readValue(T boundObject) { if (canRead()) { return readValueWithExceptionHandling(boundObject); } else { throw new IllegalStateException( "Cannot find getter method for " + boundObject.getClass().getName() + "#" + getPropertyName()); } } }
ReadMethod extends AbstractMethod<T> { public V readValue(T boundObject) { if (canRead()) { return readValueWithExceptionHandling(boundObject); } else { throw new IllegalStateException( "Cannot find getter method for " + boundObject.getClass().getName() + "#" + getPropertyName()); } } ReadMethod(PropertyAccessDescriptor<T, V> descriptor); }
ReadMethod extends AbstractMethod<T> { public V readValue(T boundObject) { if (canRead()) { return readValueWithExceptionHandling(boundObject); } else { throw new IllegalStateException( "Cannot find getter method for " + boundObject.getClass().getName() + "#" + getPropertyName()); } } ReadMethod(PropertyAccessDescriptor<T, V> descriptor); boolean canRead(); V readValue(T boundObject); @SuppressWarnings("unchecked") Class<V> getReturnType(); }
ReadMethod extends AbstractMethod<T> { public V readValue(T boundObject) { if (canRead()) { return readValueWithExceptionHandling(boundObject); } else { throw new IllegalStateException( "Cannot find getter method for " + boundObject.getClass().getName() + "#" + getPropertyName()); } } ReadMethod(PropertyAccessDescriptor<T, V> descriptor); boolean canRead(); V readValue(T boundObject); @SuppressWarnings("unchecked") Class<V> getReturnType();  }