Skip to content

Commit d0488fa

Browse files
Use parameterized Property<T> in all test entities.
1 parent 0e7a14c commit d0488fa

File tree

4 files changed

+44
-43
lines changed

4 files changed

+44
-43
lines changed

tests/objectbox-java-test/src/main/java/io/objectbox/index/model/EntityLongIndex_.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,16 @@ public class EntityLongIndex_ implements EntityInfo<EntityLongIndex> {
3838

3939
public final static EntityLongIndex_ __INSTANCE = new EntityLongIndex_();
4040

41-
public final static Property id = new Property(__INSTANCE, 0, 7, long.class, "id", true, "_id");
42-
public final static Property indexedLong = new Property(__INSTANCE, 1, 1, long.class, "indexedLong");
43-
public final static Property float1 = new Property(__INSTANCE, 2, 2, Float.class, "float1");
44-
public final static Property float2 = new Property(__INSTANCE, 3, 3, Float.class, "float2");
45-
public final static Property float3 = new Property(__INSTANCE, 4, 4, Float.class, "float3");
46-
public final static Property float4 = new Property(__INSTANCE, 5, 5, Float.class, "float4");
47-
public final static Property float5 = new Property(__INSTANCE, 6, 6, Float.class, "float5");
48-
49-
public final static Property[] __ALL_PROPERTIES = {
41+
public final static Property<EntityLongIndex> id = new Property<>(__INSTANCE, 0, 7, long.class, "id", true, "_id");
42+
public final static Property<EntityLongIndex> indexedLong = new Property<>(__INSTANCE, 1, 1, long.class, "indexedLong");
43+
public final static Property<EntityLongIndex> float1 = new Property<>(__INSTANCE, 2, 2, Float.class, "float1");
44+
public final static Property<EntityLongIndex> float2 = new Property<>(__INSTANCE, 3, 3, Float.class, "float2");
45+
public final static Property<EntityLongIndex> float3 = new Property<>(__INSTANCE, 4, 4, Float.class, "float3");
46+
public final static Property<EntityLongIndex> float4 = new Property<>(__INSTANCE, 5, 5, Float.class, "float4");
47+
public final static Property<EntityLongIndex> float5 = new Property<>(__INSTANCE, 6, 6, Float.class, "float5");
48+
49+
@SuppressWarnings("unchecked")
50+
public final static Property<EntityLongIndex>[] __ALL_PROPERTIES = new Property[]{
5051
id,
5152
indexedLong,
5253
float1,
@@ -56,15 +57,15 @@ public class EntityLongIndex_ implements EntityInfo<EntityLongIndex> {
5657
float5
5758
};
5859

59-
public final static Property __ID_PROPERTY = id;
60+
public final static Property<EntityLongIndex> __ID_PROPERTY = id;
6061

6162
@Override
62-
public Property[] getAllProperties() {
63+
public Property<EntityLongIndex>[] getAllProperties() {
6364
return __ALL_PROPERTIES;
6465
}
6566

6667
@Override
67-
public Property getIdProperty() {
68+
public Property<EntityLongIndex> getIdProperty() {
6869
return __ID_PROPERTY;
6970
}
7071

tests/objectbox-java-test/src/main/java/io/objectbox/relation/Customer_.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package io.objectbox.relation;
1919

20+
import java.util.List;
21+
2022
import io.objectbox.EntityInfo;
2123
import io.objectbox.Property;
2224
import io.objectbox.annotation.apihint.Internal;
@@ -48,15 +50,16 @@ public class Customer_ implements EntityInfo<Customer> {
4850

4951
public final static Customer_ __INSTANCE = new Customer_();
5052

51-
public final static Property id = new Property(__INSTANCE, 0, 1, long.class, "id", true, "_id");
52-
public final static Property name = new Property(__INSTANCE, 1, 2, String.class, "name");
53+
public final static Property<Customer> id = new Property<>(__INSTANCE, 0, 1, long.class, "id", true, "_id");
54+
public final static Property<Customer> name = new Property<>(__INSTANCE, 1, 2, String.class, "name");
5355

54-
public final static Property[] __ALL_PROPERTIES = {
56+
@SuppressWarnings("unchecked")
57+
public final static Property<Customer>[] __ALL_PROPERTIES = new Property[]{
5558
id,
5659
name
5760
};
5861

59-
public final static Property __ID_PROPERTY = id;
62+
public final static Property<Customer> __ID_PROPERTY = id;
6063

6164
@Override
6265
public String getEntityName() {
@@ -79,12 +82,12 @@ public String getDbName() {
7982
}
8083

8184
@Override
82-
public Property[] getAllProperties() {
85+
public Property<Customer>[] getAllProperties() {
8386
return __ALL_PROPERTIES;
8487
}
8588

8689
@Override
87-
public Property getIdProperty() {
90+
public Property<Customer> getIdProperty() {
8891
return __ID_PROPERTY;
8992
}
9093

@@ -108,8 +111,8 @@ public long getId(Customer object) {
108111
static final RelationInfo<Customer, Order> orders =
109112
new RelationInfo<>(Customer_.__INSTANCE, Order_.__INSTANCE, new ToManyGetter<Customer>() {
110113
@Override
111-
public ToMany<Order> getToMany(Customer customer) {
112-
return (ToMany<Order>) customer.getOrders();
114+
public List<Order> getToMany(Customer customer) {
115+
return customer.getOrders();
113116
}
114117
}, Order_.customerId, new ToOneGetter<Order>() {
115118
@Override
@@ -121,8 +124,8 @@ public ToOne<Customer> getToOne(Order order) {
121124
static final RelationInfo<Customer, Order> ordersStandalone =
122125
new RelationInfo<>(Customer_.__INSTANCE, Order_.__INSTANCE, new ToManyGetter<Customer>() {
123126
@Override
124-
public ToMany<Order> getToMany(Customer customer) {
125-
return (ToMany<Order>) customer.getOrders();
127+
public List<Order> getToMany(Customer customer) {
128+
return customer.getOrders();
126129
}
127130
}, 1);
128131

tests/objectbox-java-test/src/main/java/io/objectbox/relation/Order_.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,8 @@
1717

1818
package io.objectbox.relation;
1919

20-
import javax.annotation.Nullable;
21-
22-
import io.objectbox.BoxStore;
23-
import io.objectbox.Cursor;
2420
import io.objectbox.EntityInfo;
2521
import io.objectbox.Property;
26-
import io.objectbox.Transaction;
2722
import io.objectbox.annotation.apihint.Internal;
2823
import io.objectbox.internal.CursorFactory;
2924
import io.objectbox.internal.IdGetter;
@@ -53,19 +48,20 @@ public class Order_ implements EntityInfo<Order> {
5348

5449
public final static Order_ __INSTANCE = new Order_();
5550

56-
public final static Property id = new Property(__INSTANCE, 0, 1, long.class, "id", true, "_id");
57-
public final static Property date = new Property(__INSTANCE, 1, 2, java.util.Date.class, "date");
58-
public final static Property customerId = new Property(__INSTANCE, 2, 3, long.class, "customerId");
59-
public final static Property text = new Property(__INSTANCE, 3, 4, String.class, "text");
51+
public final static Property<Order> id = new Property<>(__INSTANCE, 0, 1, long.class, "id", true, "_id");
52+
public final static Property<Order> date = new Property<>(__INSTANCE, 1, 2, java.util.Date.class, "date");
53+
public final static Property<Order> customerId = new Property<>(__INSTANCE, 2, 3, long.class, "customerId");
54+
public final static Property<Order> text = new Property<>(__INSTANCE, 3, 4, String.class, "text");
6055

61-
public final static Property[] __ALL_PROPERTIES = {
56+
@SuppressWarnings("unchecked")
57+
public final static Property<Order>[] __ALL_PROPERTIES = new Property[]{
6258
id,
6359
date,
6460
customerId,
6561
text
6662
};
6763

68-
public final static Property __ID_PROPERTY = id;
64+
public final static Property<Order> __ID_PROPERTY = id;
6965

7066
@Override
7167
public String getEntityName() {
@@ -88,12 +84,12 @@ public String getDbName() {
8884
}
8985

9086
@Override
91-
public Property[] getAllProperties() {
87+
public Property<Order>[] getAllProperties() {
9288
return __ALL_PROPERTIES;
9389
}
9490

9591
@Override
96-
public Property getIdProperty() {
92+
public Property<Order> getIdProperty() {
9793
return __ID_PROPERTY;
9894
}
9995

@@ -116,7 +112,7 @@ public long getId(Order object) {
116112

117113
static final RelationInfo<Order, Customer> customer = new RelationInfo<>(Order_.__INSTANCE, Customer_.__INSTANCE, customerId, new ToOneGetter<Order>() {
118114
@Override
119-
public ToOne getToOne(Order object) {
115+
public ToOne<Customer> getToOne(Order object) {
120116
return object.customer__toOne;
121117
}
122118
});

tests/test-proguard/src/main/java/io/objectbox/test/proguard/ObfuscatedEntity_.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,18 @@ public final class ObfuscatedEntity_ implements EntityInfo<ObfuscatedEntity> {
5050

5151
public final static ObfuscatedEntity_ __INSTANCE = new ObfuscatedEntity_();
5252

53-
public final static Property id = new Property(__INSTANCE, 0, 1, long.class, "id", true, "id");
54-
public final static Property myInt = new Property(__INSTANCE, 1, 2, int.class, "myInt");
55-
public final static Property myString = new Property(__INSTANCE, 2, 3, String.class, "myString");
53+
public final static Property<ObfuscatedEntity> id = new Property<>(__INSTANCE, 0, 1, long.class, "id", true, "id");
54+
public final static Property<ObfuscatedEntity> myInt = new Property<>(__INSTANCE, 1, 2, int.class, "myInt");
55+
public final static Property<ObfuscatedEntity> myString = new Property<>(__INSTANCE, 2, 3, String.class, "myString");
5656

57-
public final static Property[] __ALL_PROPERTIES = {
57+
@SuppressWarnings("unchecked")
58+
public final static Property<ObfuscatedEntity>[] __ALL_PROPERTIES = new Property[]{
5859
id,
5960
myInt,
6061
myString
6162
};
6263

63-
public final static Property __ID_PROPERTY = id;
64+
public final static Property<ObfuscatedEntity> __ID_PROPERTY = id;
6465

6566
@Override
6667
public String getEntityName() {
@@ -83,12 +84,12 @@ public String getDbName() {
8384
}
8485

8586
@Override
86-
public Property[] getAllProperties() {
87+
public Property<ObfuscatedEntity>[] getAllProperties() {
8788
return __ALL_PROPERTIES;
8889
}
8990

9091
@Override
91-
public Property getIdProperty() {
92+
public Property<ObfuscatedEntity> getIdProperty() {
9293
return __ID_PROPERTY;
9394
}
9495

0 commit comments

Comments
 (0)