Advanced Features in Java: Using Custom Annotations

Java    |    Expert
  • 13 videos | 1h 29m 52s
  • Includes Assessment
  • Earns a Badge
Rating 4.8 of 4 users Rating 4.8 of 4 users (4)
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

  • 2m 21s
  • 7m 54s
    Upon completion of this video, you will be able to describe how varargs are defined and used. FREE ACCESS
  • Locked
    3.  Introduction to the @SafeVarargs Annotation
    7m 36s
    During 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
  • Locked
    4.  The @FunctionalInterface Annotation
    6m 34s
    After 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
  • Locked
    5.  Some Quirks of the @FunctionalInterface Annotation
    5m 37s
    After completing this video, you will be able to recognize what counts as a functional interface and what does not. FREE ACCESS
  • Locked
    6.  Introduction to Custom Annotations
    10m 28s
    Upon 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
  • Locked
    7.  Experimentation with the Target Policy
    5m 33s
    In this video, find out how to change the target policy to control exactly what code elements an annotation can be applied to. FREE ACCESS
  • Locked
    8.  Code Checks Using Custom Annotations
    11m 6s
    During this video, you will learn how to ensure that all the elements marked with an annotation meet certain conditions. FREE ACCESS
  • Locked
    9.  Experimentation with Named Elements
    7m 49s
    In this video, find out how to annotate using named elements. FREE ACCESS
  • Locked
    10.  Default Values in Annotations
    10m 34s
    During this video, you will learn how to apply default values to an element in annotation and also experiment with unnamed elements. FREE ACCESS
  • Locked
    11.  Using the Target Policy Type_Parameter
    6m 52s
    In this video, you will learn how to use an annotation with a type parameter. FREE ACCESS
  • Locked
    12.  Using the Target Policy Type_Use
    5m 20s
    After completing this video, you will be able to recognize how annotations can be used with the target policy Type_Use. FREE ACCESS
  • 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 on some of our courses, which can be shared on any social network or business platform.

Digital badges are yours to keep, forever.

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.8 of 13 users Rating 4.8 of 13 users (13)
Rating 4.0 of 22 users Rating 4.0 of 22 users (22)
Rating 5.0 of 3 users Rating 5.0 of 3 users (3)