What is receiver
parameter in Java ? Java 8 Language Specification talks about this
.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
The JLS gives a hint:
These two methods are equivalent:
However the latter allows you to add annotations:
Receiver parameters allow to pass arguments and extract additional information from these arguments. The only purpose of writing the receiver explicitly is to make it possible to annotate the receiver’s type. Now, if you implement the AnnotatedElement interface, you could call the getAnnotation() method of your class to get an annotation type. For more information, you can read this.