GeezerVison is showing github.com — Unchecked warnings: fix type params for ToOneGetter/ToManyGetter (#59) · yomigatz/objectbox-java@e5f579d
File treeExpand file treeCollapse file tree Open diff view settings objectbox-java/src/main/java/io/objectbox tests/objectbox-java-test/src main/java/io/objectbox/relation test/java/io/objectbox/tree
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: objectbox-java/src/main/java/io/objectbox/internal/ToManyGetter.java +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 22 | 22 | import io.objectbox.annotation.apihint.Internal; | 23 | 23 |
| 24 | 24 | @Internal | 25 | | -public interface ToManyGetter<SOURCE> extends Serializable { | 26 | | - <TARGET> List<TARGET> getToMany(SOURCE object); | | 25 | +public interface ToManyGetter<SOURCE, TARGET> extends Serializable { | | 26 | + List<TARGET> getToMany(SOURCE object); | 27 | 27 | } |
Collapse file Copy file name to clipboardExpand all lines: objectbox-java/src/main/java/io/objectbox/internal/ToOneGetter.java +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 22 | 22 | import io.objectbox.relation.ToOne; | 23 | 23 |
| 24 | 24 | @Internal | 25 | | -public interface ToOneGetter<SOURCE> extends Serializable { | 26 | | - <TARGET> ToOne<TARGET> getToOne(SOURCE object); | | 25 | +public interface ToOneGetter<SOURCE, TARGET> extends Serializable { | | 26 | + ToOne<TARGET> getToOne(SOURCE object); | 27 | 27 | } |
Collapse file Copy file name to clipboardExpand all lines: objectbox-java/src/main/java/io/objectbox/relation/RelationInfo.java +10-10Lines changed: 10 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -46,16 +46,16 @@ public class RelationInfo<SOURCE, TARGET> implements Serializable { | 46 | 46 | public final int targetRelationId; | 47 | 47 |
| 48 | 48 | /** Only set for ToOne relations */ | 49 | | - public final ToOneGetter<SOURCE> toOneGetter; | | 49 | + public final ToOneGetter<SOURCE, TARGET> toOneGetter; | 50 | 50 |
| 51 | 51 | /** Only set for ToMany relations */ | 52 | | - public final ToManyGetter<SOURCE> toManyGetter; | | 52 | + public final ToManyGetter<SOURCE, TARGET> toManyGetter; | 53 | 53 |
| 54 | 54 | /** For ToMany relations based on ToOne backlinks (null otherwise). */ | 55 | | - public final ToOneGetter<TARGET> backlinkToOneGetter; | | 55 | + public final ToOneGetter<TARGET, SOURCE> backlinkToOneGetter; | 56 | 56 |
| 57 | 57 | /** For ToMany relations based on ToMany backlinks (null otherwise). */ | 58 | | - public final ToManyGetter<TARGET> backlinkToManyGetter; | | 58 | + public final ToManyGetter<TARGET, SOURCE> backlinkToManyGetter; | 59 | 59 |
| 60 | 60 | /** For stand-alone to-many relations (0 otherwise). */ | 61 | 61 | public final int relationId; | @@ -64,7 +64,7 @@ public class RelationInfo<SOURCE, TARGET> implements Serializable { | 64 | 64 | * ToOne | 65 | 65 | */ | 66 | 66 | public RelationInfo(EntityInfo<SOURCE> sourceInfo, EntityInfo<TARGET> targetInfo, Property<SOURCE> targetIdProperty, | 67 | | - ToOneGetter<SOURCE> toOneGetter) { | | 67 | + ToOneGetter<SOURCE, TARGET> toOneGetter) { | 68 | 68 | this.sourceInfo = sourceInfo; | 69 | 69 | this.targetInfo = targetInfo; | 70 | 70 | this.targetIdProperty = targetIdProperty; | @@ -79,8 +79,8 @@ public RelationInfo(EntityInfo<SOURCE> sourceInfo, EntityInfo<TARGET> targetInfo | 79 | 79 | /** | 80 | 80 | * ToMany as a ToOne backlink | 81 | 81 | */ | 82 | | - public RelationInfo(EntityInfo<SOURCE> sourceInfo, EntityInfo<TARGET> targetInfo, ToManyGetter<SOURCE> toManyGetter, | 83 | | - Property<TARGET> targetIdProperty, ToOneGetter<TARGET> backlinkToOneGetter) { | | 82 | + public RelationInfo(EntityInfo<SOURCE> sourceInfo, EntityInfo<TARGET> targetInfo, ToManyGetter<SOURCE, TARGET> toManyGetter, | | 83 | + Property<TARGET> targetIdProperty, ToOneGetter<TARGET, SOURCE> backlinkToOneGetter) { | 84 | 84 | this.sourceInfo = sourceInfo; | 85 | 85 | this.targetInfo = targetInfo; | 86 | 86 | this.targetIdProperty = targetIdProperty; | @@ -95,8 +95,8 @@ public RelationInfo(EntityInfo<SOURCE> sourceInfo, EntityInfo<TARGET> targetInfo | 95 | 95 | /** | 96 | 96 | * ToMany as a ToMany backlink | 97 | 97 | */ | 98 | | - public RelationInfo(EntityInfo<SOURCE> sourceInfo, EntityInfo<TARGET> targetInfo, ToManyGetter<SOURCE> toManyGetter, | 99 | | - ToManyGetter<TARGET> backlinkToManyGetter, int targetRelationId) { | | 98 | + public RelationInfo(EntityInfo<SOURCE> sourceInfo, EntityInfo<TARGET> targetInfo, ToManyGetter<SOURCE, TARGET> toManyGetter, | | 99 | + ToManyGetter<TARGET, SOURCE> backlinkToManyGetter, int targetRelationId) { | 100 | 100 | this.sourceInfo = sourceInfo; | 101 | 101 | this.targetInfo = targetInfo; | 102 | 102 | this.toManyGetter = toManyGetter; | @@ -111,7 +111,7 @@ public RelationInfo(EntityInfo<SOURCE> sourceInfo, EntityInfo<TARGET> targetInfo | 111 | 111 | /** | 112 | 112 | * Stand-alone ToMany. | 113 | 113 | */ | 114 | | - public RelationInfo(EntityInfo<SOURCE> sourceInfo, EntityInfo<TARGET> targetInfo, ToManyGetter<SOURCE> toManyGetter, | | 114 | + public RelationInfo(EntityInfo<SOURCE> sourceInfo, EntityInfo<TARGET> targetInfo, ToManyGetter<SOURCE, TARGET> toManyGetter, | 115 | 115 | int relationId) { | 116 | 116 | this.sourceInfo = sourceInfo; | 117 | 117 | this.targetInfo = targetInfo; | |
Collapse file Copy file name to clipboardExpand all lines: objectbox-java/src/main/java/io/objectbox/relation/ToMany.java +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -696,7 +696,7 @@ public boolean internalCheckApplyToDbRequired() { | 696 | 696 |
| 697 | 697 | private boolean prepareToManyBacklinkEntitiesForDb(long entityId, IdGetter<TARGET> idGetter, | 698 | 698 | @Nullable Map<TARGET, Boolean> setAdded, @Nullable Map<TARGET, Boolean> setRemoved) { | 699 | | - ToManyGetter<TARGET> backlinkToManyGetter = relationInfo.backlinkToManyGetter; | | 699 | + ToManyGetter<TARGET, Object> backlinkToManyGetter = relationInfo.backlinkToManyGetter; | 700 | 700 |
| 701 | 701 | synchronized (this) { | 702 | 702 | if (setAdded != null && !setAdded.isEmpty()) { | @@ -740,7 +740,7 @@ private boolean prepareToManyBacklinkEntitiesForDb(long entityId, IdGetter<TARGE | 740 | 740 |
| 741 | 741 | private boolean prepareToOneBacklinkEntitiesForDb(long entityId, IdGetter<TARGET> idGetter, | 742 | 742 | @Nullable Map<TARGET, Boolean> setAdded, @Nullable Map<TARGET, Boolean> setRemoved) { | 743 | | - ToOneGetter<TARGET> backlinkToOneGetter = relationInfo.backlinkToOneGetter; | | 743 | + ToOneGetter<TARGET, Object> backlinkToOneGetter = relationInfo.backlinkToOneGetter; | 744 | 744 |
| 745 | 745 | synchronized (this) { | 746 | 746 | if (setAdded != null && !setAdded.isEmpty()) { | |
Collapse file Copy file name to clipboardExpand all lines: tests/objectbox-java-test/src/main/java/io/objectbox/relation/Customer_.java +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -109,20 +109,20 @@ public long getId(Customer object) { | 109 | 109 | } | 110 | 110 |
| 111 | 111 | public static final RelationInfo<Customer, Order> orders = | 112 | | - new RelationInfo<>(Customer_.__INSTANCE, Order_.__INSTANCE, new ToManyGetter<Customer>() { | | 112 | + new RelationInfo<>(Customer_.__INSTANCE, Order_.__INSTANCE, new ToManyGetter<Customer, Order>() { | 113 | 113 | @Override | 114 | 114 | public List<Order> getToMany(Customer customer) { | 115 | 115 | return customer.getOrders(); | 116 | 116 | } | 117 | | - }, Order_.customerId, new ToOneGetter<Order>() { | | 117 | + }, Order_.customerId, new ToOneGetter<Order, Customer>() { | 118 | 118 | @Override | 119 | 119 | public ToOne<Customer> getToOne(Order order) { | 120 | 120 | return order.getCustomer(); | 121 | 121 | } | 122 | 122 | }); | 123 | 123 |
| 124 | 124 | public static final RelationInfo<Customer, Order> ordersStandalone = | 125 | | - new RelationInfo<>(Customer_.__INSTANCE, Order_.__INSTANCE, new ToManyGetter<Customer>() { | | 125 | + new RelationInfo<>(Customer_.__INSTANCE, Order_.__INSTANCE, new ToManyGetter<Customer, Order>() { | 126 | 126 | @Override | 127 | 127 | public List<Order> getToMany(Customer customer) { | 128 | 128 | return customer.getOrders(); | |
Collapse file Copy file name to clipboardExpand all lines: tests/objectbox-java-test/src/main/java/io/objectbox/relation/Order_.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -110,7 +110,7 @@ public long getId(Order object) { | 110 | 110 | } | 111 | 111 | } | 112 | 112 |
| 113 | | - public static final RelationInfo<Order, Customer> customer = new RelationInfo<>(Order_.__INSTANCE, Customer_.__INSTANCE, customerId, new ToOneGetter<Order>() { | | 113 | + public static final RelationInfo<Order, Customer> customer = new RelationInfo<>(Order_.__INSTANCE, Customer_.__INSTANCE, customerId, new ToOneGetter<Order, Customer>() { | 114 | 114 | @Override | 115 | 115 | public ToOne<Customer> getToOne(Order object) { | 116 | 116 | return object.getCustomer(); | |
Collapse file Copy file name to clipboardExpand all lines: tests/objectbox-java-test/src/test/java/io/objectbox/tree/DataBranch_.java +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -106,7 +106,7 @@ public long getId(DataBranch object) { | 106 | 106 |
| 107 | 107 | /** To-one relation "parent" to target entity "DataBranch". */ | 108 | 108 | public static final RelationInfo<DataBranch, DataBranch> parent = | 109 | | - new RelationInfo<>(DataBranch_.__INSTANCE, DataBranch_.__INSTANCE, parentId, new ToOneGetter<DataBranch>() { | | 109 | + new RelationInfo<>(DataBranch_.__INSTANCE, DataBranch_.__INSTANCE, parentId, new ToOneGetter<DataBranch, DataBranch>() { | 110 | 110 | @Override | 111 | 111 | public ToOne<DataBranch> getToOne(DataBranch entity) { | 112 | 112 | return entity.parent; | @@ -115,7 +115,7 @@ public ToOne<DataBranch> getToOne(DataBranch entity) { | 115 | 115 |
| 116 | 116 | /** To-one relation "metaBranch" to target entity "MetaBranch". */ | 117 | 117 | public static final RelationInfo<DataBranch, MetaBranch> metaBranch = | 118 | | - new RelationInfo<>(DataBranch_.__INSTANCE, MetaBranch_.__INSTANCE, metaBranchId, new ToOneGetter<DataBranch>() { | | 118 | + new RelationInfo<>(DataBranch_.__INSTANCE, MetaBranch_.__INSTANCE, metaBranchId, new ToOneGetter<DataBranch, MetaBranch>() { | 119 | 119 | @Override | 120 | 120 | public ToOne<MetaBranch> getToOne(DataBranch entity) { | 121 | 121 | return entity.metaBranch; | |
Collapse file Copy file name to clipboardExpand all lines: tests/objectbox-java-test/src/test/java/io/objectbox/tree/DataLeaf_.java +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -118,7 +118,7 @@ public long getId(DataLeaf object) { | 118 | 118 |
| 119 | 119 | /** To-one relation "dataBranch" to target entity "DataBranch". */ | 120 | 120 | public static final RelationInfo<DataLeaf, DataBranch> dataBranch = | 121 | | - new RelationInfo<>(DataLeaf_.__INSTANCE, io.objectbox.tree.DataBranch_.__INSTANCE, dataBranchId, new ToOneGetter<DataLeaf>() { | | 121 | + new RelationInfo<>(DataLeaf_.__INSTANCE, io.objectbox.tree.DataBranch_.__INSTANCE, dataBranchId, new ToOneGetter<DataLeaf, DataBranch>() { | 122 | 122 | @Override | 123 | 123 | public ToOne<DataBranch> getToOne(DataLeaf entity) { | 124 | 124 | return entity.dataBranch; | @@ -127,7 +127,7 @@ public ToOne<DataBranch> getToOne(DataLeaf entity) { | 127 | 127 |
| 128 | 128 | /** To-one relation "metaLeaf" to target entity "MetaLeaf". */ | 129 | 129 | public static final RelationInfo<DataLeaf, MetaLeaf> metaLeaf = | 130 | | - new RelationInfo<>(DataLeaf_.__INSTANCE, io.objectbox.tree.MetaLeaf_.__INSTANCE, metaLeafId, new ToOneGetter<DataLeaf>() { | | 130 | + new RelationInfo<>(DataLeaf_.__INSTANCE, io.objectbox.tree.MetaLeaf_.__INSTANCE, metaLeafId, new ToOneGetter<DataLeaf, MetaLeaf>() { | 131 | 131 | @Override | 132 | 132 | public ToOne<MetaLeaf> getToOne(DataLeaf entity) { | 133 | 133 | return entity.metaLeaf; | |
Collapse file Copy file name to clipboardExpand all lines: tests/objectbox-java-test/src/test/java/io/objectbox/tree/MetaBranch_.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -106,7 +106,7 @@ public long getId(MetaBranch object) { | 106 | 106 |
| 107 | 107 | /** To-one relation "parent" to target entity "MetaBranch". */ | 108 | 108 | public static final RelationInfo<MetaBranch, MetaBranch> parent = | 109 | | - new RelationInfo<>(MetaBranch_.__INSTANCE, MetaBranch_.__INSTANCE, parentId, new ToOneGetter<MetaBranch>() { | | 109 | + new RelationInfo<>(MetaBranch_.__INSTANCE, MetaBranch_.__INSTANCE, parentId, new ToOneGetter<MetaBranch, MetaBranch>() { | 110 | 110 | @Override | 111 | 111 | public ToOne<MetaBranch> getToOne(MetaBranch entity) { | 112 | 112 | return entity.parent; | |
Collapse file Copy file name to clipboardExpand all lines: tests/objectbox-java-test/src/test/java/io/objectbox/tree/MetaLeaf_.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -129,7 +129,7 @@ public long getId(MetaLeaf object) { | 129 | 129 |
| 130 | 130 | /** To-one relation "branch" to target entity "MetaBranch". */ | 131 | 131 | public static final RelationInfo<MetaLeaf, MetaBranch> branch = | 132 | | - new RelationInfo<>(MetaLeaf_.__INSTANCE, MetaBranch_.__INSTANCE, branchId, new ToOneGetter<MetaLeaf>() { | | 132 | + new RelationInfo<>(MetaLeaf_.__INSTANCE, MetaBranch_.__INSTANCE, branchId, new ToOneGetter<MetaLeaf, MetaBranch>() { | 133 | 133 | @Override | 134 | 134 | public ToOne<MetaBranch> getToOne(MetaLeaf entity) { | 135 | 135 | return entity.branch; | |
|