@Test public void testCanRead() { TestObject testObject2 = new TestObject(); PropertyAccessor<TestObject, Long> propertyAccessor = new PropertyAccessor<>(TestObject.class, TestObject.READ_ONLY_LONG_PROPERTY); assertThat((propertyAccessor.canWrite()), is(false)); assertThat(propertyAccessor.canRead()); Long propertyValue = propertyAccessor.getPropertyValue(testObject2); assertEquals(42, propertyValue.longValue()); }
public boolean canRead() { return readMethod.canRead(); }
PropertyAccessor { public boolean canRead() { return readMethod.canRead(); } }
PropertyAccessor { public boolean canRead() { return readMethod.canRead(); } PropertyAccessor(Class<? extends T> boundClass, String propertyName); }
PropertyAccessor { public boolean canRead() { return readMethod.canRead(); } PropertyAccessor(Class<? extends T> boundClass, String propertyName); String getPropertyName(); V getPropertyValue(T boundObject); void setPropertyValue(T boundObject, @CheckForNull V value); void invoke(T boundObject); boolean canWrite(); boolean canInvoke(); boolean canRead(); Class<?> getValueClass(); }
PropertyAccessor { public boolean canRead() { return readMethod.canRead(); } PropertyAccessor(Class<? extends T> boundClass, String propertyName); String getPropertyName(); V getPropertyValue(T boundObject); void setPropertyValue(T boundObject, @CheckForNull V value); void invoke(T boundObject); boolean canWrite(); boolean canInvoke(); boolean canRead(); Class<?> getValueClass();  }