Skip to content

Instantly share code, notes, and snippets.

@kevinhooke
Created August 30, 2017 17:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinhooke/0a566b490bf29fe57aca9e51d069efeb to your computer and use it in GitHub Desktop.
Save kevinhooke/0a566b490bf29fe57aca9e51d069efeb to your computer and use it in GitHub Desktop.
Java Annotations on multiple target types
By default, @Target on one type, eg for properties:
@Target(ElementType.FIELD)
public @interface ExamplePropertyAnnotation
Specifying multiple targets as a List of target types:
@Target( { ElementType.FIELD, ElementType.PARAMETER } )
public @interface ExamplePropertyAndParameterAnnotation
@williamniemiec
Copy link

Thanks!

@Arzulla
Copy link

Arzulla commented Sep 13, 2021

Thanks!

@vivekshukla24
Copy link

Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment