@Documented @Retention(value=RUNTIME) @Target(value=FIELD) @Inherited public @interface Key
public class HelloMessage {
private @Key
int id;
private String message;
}
An example with multiple Key elements:
public class HelloMessage {
private @Key(index = 0)
int id;
private @Key(index = 1)
long foreignId;
private String message;
}
| Modifier and Type | Optional Element and Description |
|---|---|
int |
index
Get the index of the key.
|
public abstract int index
It is an error to provide two fields with same index.
Copyright © 2016. All rights reserved.