Advanced Features in Java: Using Custom Annotations
Java
| 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
-
2m 21s
-
7m 54sUpon completion of this video, you will be able to describe how varargs are defined and used. FREE ACCESS
-
7m 36sDuring this video, you will learn how to apply that the @SafeVarargs annotation is purely indicative and does not perform any run-time or compile-time checks. FREE ACCESS
-
6m 34sAfter completing this video, you will be able to recognize how functional interfaces must contain exactly one abstract method and what qualifies as an abstract method in this context. FREE ACCESS
-
5m 37sAfter completing this video, you will be able to recognize what counts as a functional interface and what does not. FREE ACCESS
-
10m 28sUpon completion of this video, you will be able to describe 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 them. FREE ACCESS
-
5m 33sIn this video, find out how to change the target policy to control exactly what code elements an annotation can be applied to. FREE ACCESS
-
11m 6sDuring this video, you will learn how to ensure that all the elements marked with an annotation meet certain conditions. FREE ACCESS
-
7m 49sIn this video, find out how to annotate using named elements. FREE ACCESS
-
10m 34sDuring this video, you will learn how to apply default values to an element in annotation and also experiment with unnamed elements. FREE ACCESS
-
6m 52sIn this video, you will learn how to use an annotation with a type parameter. FREE ACCESS
-
5m 20sAfter completing this video, you will be able to recognize how annotations can be used with the target policy Type_Use. FREE ACCESS
-
2m 7s
EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE
Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.
Digital badges are yours to keep, forever.