Skip to content

Commit bfb68a2

Browse files
Enforce db and Java types match for PropertyConverter in Property constructors.
1 parent c7b8a75 commit bfb68a2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

objectbox-java/src/main/java/io/objectbox/Property.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ public class Property<ENTITY> implements Serializable {
4747
public final boolean isId;
4848
public final boolean isVirtual;
4949
public final String dbName;
50-
public final Class<? extends PropertyConverter> converterClass;
50+
public final Class<? extends PropertyConverter<?, ?>> converterClass;
5151

5252
/** Type, which is converted to a type supported by the DB. */
53-
public final Class customType;
53+
public final Class<?> customType;
5454

5555
// TODO verified state should be per DB -> move to BoxStore/Box.
5656
// Also, this should make the Property class truly @Immutable.
@@ -69,15 +69,15 @@ public Property(EntityInfo<ENTITY> entity, int ordinal, int id, Class<?> type, S
6969
this(entity, ordinal, id, type, name, isId, dbName, null, null);
7070
}
7171

72-
public Property(EntityInfo<ENTITY> entity, int ordinal, int id, Class<?> type, String name, boolean isId,
73-
@Nullable String dbName, @Nullable Class<? extends PropertyConverter> converterClass,
74-
@Nullable Class customType) {
72+
public <P, D> Property(EntityInfo<ENTITY> entity, int ordinal, int id, Class<D> type, String name, boolean isId,
73+
@Nullable String dbName, @Nullable Class<? extends PropertyConverter<P, D>> converterClass,
74+
@Nullable Class<P> customType) {
7575
this(entity, ordinal, id, type, name, isId, false, dbName, converterClass, customType);
7676
}
7777

78-
public Property(EntityInfo<ENTITY> entity, int ordinal, int id, Class<?> type, String name, boolean isId,
78+
public <P, D> Property(EntityInfo<ENTITY> entity, int ordinal, int id, Class<D> type, String name, boolean isId,
7979
boolean isVirtual, @Nullable String dbName,
80-
@Nullable Class<? extends PropertyConverter> converterClass, @Nullable Class customType) {
80+
@Nullable Class<? extends PropertyConverter<P, D>> converterClass, @Nullable Class<P> customType) {
8181
this.entity = entity;
8282
this.ordinal = ordinal;
8383
this.id = id;

0 commit comments

Comments
 (0)