user84592
user84592

Reputation: 4882

Annotation ElementType

What does following annotation's ElementType means?

@Entity
@Table(table="application")
@ElementType(type=1L) 
class application extends Element

Upvotes: 3

Views: 816

Answers (4)

Brad C
Brad C

Reputation: 441

The first two annotations are clearly Java Persistence annotations. There is no JPA or Hibernate annotation ElementType so it is not possible to tell from this code snippet what it means.

The fully qualified name for ElementType would provide some more clues, but more than likely this is a custom annotation; the definition of which resides in your code base.

Upvotes: 0

Yishai
Yishai

Reputation: 91881

Assuming this code compiles, there is a lot wrong with it. ElementType is an enum in the JDK, not an annotation, so this has to be a custom annotation interface. It uses a common annotation-related class name for an annotation, creating confusion. It uses a long instead of an enum, or at least a declared constant to define a type which is most likely not to be understood as a numeric. And it declares a class name in all lower case.

Upvotes: 0

Bartosz Bierkowski
Bartosz Bierkowski

Reputation: 2782

Please check: ElementType. It's an enum and all fields are defined there. You shouldn't rely on numeric values in your code.

Upvotes: 2

Michael Borgwardt
Michael Borgwardt

Reputation: 346300

That's a literal of type long and value 1. What it means depends on the definition of the annotation, but most likely there are constants defined in the ElementType annotation class that you're supposed to use instead of long literals.

Upvotes: 0

Related Questions