In Java Lang Tutorial you will learn handy features of classes from java.lang package! Java Lang Classes Java Objects equals hashcode Shows how to use (new in Java 7) Objects to implement equals and hashcode. Java null check Shows how to validate input using (new in Java 7) Objects class. Java external process How to …
Problem: How to find annotated classes in Java? JDK by itself doesn’t provide such mechanism, but there are libraries that can do that. One of them is Reflections, which is used in the following example.
Problem: How to find annotated classes using Spring and read metadata from them? Sometimes you may want to attach metadata to your classes using custom annotations. Here’s an example how you can leverage Spring‘s classpath scanning mechanism to do that.
Problem: How to use Java Reflection to find annotated fields and/or methods? java.lang.reflect provides means to do it fairly easily as can be seen in the following example.
Problem: How to get Java generic type parameter using reflection in runtime? Java doesn’t make it easy with type erasure, but it’s possible. See how.