I am looking for a utility class or library that gives me the name of the property in a type-safe way. I have something similar like the following in mind:
PropertyDescriptor descriptor = property(on(Foo.class).getBar());
assertThat(descriptor.getName()).isEqualTo("bar")
To have such a convenience method implemented properly requires IMHO quiet a lot of work. As the handling of final classes and the like can be extremely complex (see mockito, easymock etc.)
Aucun commentaire:
Enregistrer un commentaire