One of the things library developers often miss in Java are property literals.
In this post I’m going to show how to make creative use of Java 8 method references to emulate property literals, with the help of some byte code generation.
Akin to class literals (e.g. Customer.class), property literals would allow to refer to the properties of a bean class in a type-safe manner.
This would be useful for designing APIs that run actions on specific bean properties or apply some means of configuration to them.
E.g. consider the API for programmatic configuration of index mappings in Hibernate Search:
In this post, I’d like you to meet Martin, who, in spite of his young age, has been very active in the Hibernate Search project development,
implementing some interesting extensions or helping with pull request reviewing.
Because I’d love to see more university students getting involved with open source software, I took this opportunity and interviewed Martin about this experience.