Skip to content

Commit 934e3ab

Browse files
committed
API_ added @TargetIdProperty, deprecated old annotations
1 parent 56469b5 commit 934e3ab

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

objectbox-java-api/src/main/java/io/objectbox/annotation/Backlink.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
* <p>
1313
* Example: one "Order" references one "Customer" (to-one relation).
1414
* The backlink to this is a to-many in the reverse direction: one "Customer" has a number of "Order"s.
15+
*
16+
* Note: backlinks to to-many relations will be supported in the future.
1517
*/
1618
@Retention(RetentionPolicy.CLASS)
1719
@Target(ElementType.FIELD)

objectbox-java-api/src/main/java/io/objectbox/annotation/Generated.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515
@Retention(RetentionPolicy.CLASS)
1616
@Target({ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.METHOD})
17+
@Deprecated
1718
public @interface Generated {
1819
/** A hash to identify the generated code */
1920
int value() default -1;

objectbox-java-api/src/main/java/io/objectbox/annotation/Keep.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@
2020
*/
2121
@Retention(RetentionPolicy.CLASS)
2222
@Target({ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.TYPE})
23+
@Deprecated
2324
public @interface Keep {
2425
}

objectbox-java-api/src/main/java/io/objectbox/annotation/Relation.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
@Target(ElementType.FIELD)
1717
@Beta
1818
@Temporary
19+
@Deprecated
1920
public @interface Relation {
2021
/**
2122
* Name of the property (in the source entity) holding the id (key) as a base for this to-one relation.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package io.objectbox.annotation;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Defines the property serving as the target ID of a ToOne.
10+
* This allows exposing an explicit property, which may be convenient for other parsers/serializers (e.g. JSON).
11+
*/
12+
@Retention(RetentionPolicy.CLASS)
13+
@Target({ElementType.FIELD, ElementType.TYPE})
14+
public @interface TargetIdProperty {
15+
/**
16+
* Name used in the database.
17+
*/
18+
String value();
19+
20+
}

0 commit comments

Comments
 (0)