Advanced Features in Java: Using Custom Annotations

Java SE 13
  • 13 Videos | 1h 35m 22s
  • Includes Assessment
  • Earns a Badge
Likes 7 Likes 7
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 course
    describe how varargs are defined and used
    demonstrate that the @SafeVarargs annotation is purely indicative and does not perform any run-time or compile-time checks
    recognize how functional interfaces must contain exactly one abstract method and what qualifies as an abstract method in this context
    recognize exactly what counts as a functional interface and what does not
    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
    change 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 conditions
    demonstrate the use of named elements in an annotation
    apply default values to an element in annotation and also experiment with unnamed elements
    identify how to use an annotation with a type parameter
    recognize how annotations can be used with target policy Type_Use
    summarize the key concepts covered in this course

IN THIS COURSE

  • Playable
    1. 
    Course Overview
    2m 21s
    UP NEXT
  • Playable
    2. 
    Java Varargs - Variable Arguments
    7m 54s
  • Locked
    3. 
    Introduction to the @SafeVarargs Annotation
    7m 36s
  • Locked
    4. 
    The @FunctionalInterface Annotation
    6m 34s
  • Locked
    5. 
    Some Quirks of the @FunctionalInterface Annotation
    5m 37s
  • Locked
    6. 
    Introduction to Custom Annotations
    10m 28s
  • Locked
    7. 
    Experimentation with the Target Policy
    5m 33s
  • Locked
    8. 
    Code Checks Using Custom Annotations
    11m 6s
  • Locked
    9. 
    Experimentation with Named Elements
    7m 49s
  • Locked
    10. 
    Default Values in Annotations
    10m 34s
  • Locked
    11. 
    Using the Target Policy Type_Parameter
    6m 52s
  • Locked
    12. 
    Using the Target Policy Type_Use
    5m 20s
  • Locked
    13. 
    Course Summary
    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 of this course, which can be shared on any social network or business platform

Digital badges are yours to keep, forever.

YOU MIGHT ALSO LIKE