Constructor getAnnotatedReceiverType() method in Java with Examples
The getAnnotatedReceiverType() method of a Constructor class is used to return an AnnotatedType object that represents the AnnotatedType to specify the receiver type of this constructor. If the constructor has a receiver parameter then The receiver type of a constructor is available. If this constructor either has no receiver parameter or has a receiver parameter with no annotations on its type, then the return value is an AnnotatedType object representing an element with no annotations. If this constructor is a top-level static member then the return value is null.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
public AnnotatedType getAnnotatedReceiverType()
Parameters: This method accepts nothing.
Return value: This method returns an object of AnnotatedType representing the receiver type of the method or constructor represented by this Executable or null if this Executable can not have a receiver parameter.
Below programs illustrate the getAnnotatedReceiverType() method:
sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl@12a3a380 Type = Test
sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl@12a3a380 Type = Demo