annotations
4 tutorials tagged “annotations”.
- Creating Objects and Calling Methods with ReflectionCreate objects with Constructor.newInstance, call methods with Method.invoke, handle InvocationTargetException, and build a mini test runner with @Test.
- Custom Annotations in JavaDeclare your own annotations with @interface: elements, defaults, allowed types and the value shortcut, then read them with reflection in a field validator.
- Annotations in JavaWhat annotations are and how the built-in ones work: @Override, @Deprecated, @SuppressWarnings, @FunctionalInterface and @SafeVarargs, with compiler output.
- Meta-Annotations in JavaAnnotations that describe other annotations: @Retention, @Target, @Documented, @Inherited and @Repeatable, each shown with a runnable example.