Advanced Features in Java: Using Custom Annotations
Java SE 13
| Expert
- 13 Videos | 1h 29m 52s
- Includes Assessment
- Earns a Badge
In this course, you'll learn about two advanced built-in annotations, @SafeVarargs and @FunctionalInterface, before moving on to defining and using your own custom annotations. You'll begin with @SafeVarargs and see that it is purely indicative and does not imply any added compiler checks, so it is important to not be lulled into a false sense of security about methods that have been decorated with this annotation. Next, you'll move to another built-in annotation, @FunctionalInterface. This is used to decorate interfaces that contain exactly one abstract method. Finally, you'll learn how to define and use custom annotations. This will involve a detailed study of target and retention policies. The retention policy determines whether the annotation will be preserved only in source code, into compiled bytecode, or all the way to runtime. Finally, you'll see how the target policy governs what code elements - fields, methods, constructors, type parameters, and classes - can be decorated with an annotation.
WHAT YOU WILL LEARN
-
discover the key concepts covered in this coursedescribe how varargs are defined and useddemonstrate that the @SafeVarargs annotation is purely indicative and does not perform any run-time or compile-time checksrecognize how functional interfaces must contain exactly one abstract method and what qualifies as an abstract method in this contextrecognize exactly what counts as a functional interface and what does notdescribe the use of custom annotations and recognize that these are usually purely intended to be understood by programmers and that the standard Java compiler does not understand themchange the target policy to control exactly what code elements an annotation can be applied to
-
ensure that all the elements marked with an annotation satisfy certain conditionsdemonstrate the use of named elements in an annotationapply default values to an element in annotation and also experiment with unnamed elementsidentify how to use an annotation with a type parameterrecognize how annotations can be used with target policy Type_Usesummarize the key concepts covered in this course
IN THIS COURSE
-
1.Course Overview2m 21sUP NEXT
-
2.Java Varargs - Variable Arguments7m 54s
-
3.Introduction to the @SafeVarargs Annotation7m 36s
-
4.The @FunctionalInterface Annotation6m 34s
-
5.Some Quirks of the @FunctionalInterface Annotation5m 37s
-
6.Introduction to Custom Annotations10m 28s
-
7.Experimentation with the Target Policy5m 33s
-
8.Code Checks Using Custom Annotations11m 6s
-
9.Experimentation with Named Elements7m 49s
-
10.Default Values in Annotations10m 34s
-
11.Using the Target Policy Type_Parameter6m 52s
-
12.Using the Target Policy Type_Use5m 20s
-
13.Course Summary2m 7s
EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE
Skillsoft is providing you the opportunity to earn a digital badge upon successful completion of this course, which can be shared on any social network or business platform
Digital badges are yours to keep, forever.