Skip to content

Commit cef8d42

Browse files
committed
renamed Properties to EntityInfo
1 parent 11f9a60 commit cef8d42

18 files changed

Lines changed: 36 additions & 46 deletions

File tree

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class Box<T> {
3636
private final IdGetter<T> idGetter;
3737
private final boolean debugTx;
3838

39-
private Properties properties;
39+
private EntityInfo entityInfo;
4040
private volatile Field boxStoreField;
4141

4242
Box(BoxStore store, Class<T> entityClass) {
@@ -490,16 +490,16 @@ public BoxStore getStore() {
490490
return store;
491491
}
492492

493-
public synchronized Properties getProperties() {
494-
if (properties == null) {
493+
public synchronized EntityInfo getEntityInfo() {
494+
if (entityInfo == null) {
495495
Cursor<T> reader = getReader();
496496
try {
497-
properties = reader.getProperties();
497+
entityInfo = reader.getEntityInfo();
498498
} finally {
499499
releaseReader(reader);
500500
}
501501
}
502-
return properties;
502+
return entityInfo;
503503
}
504504

505505
@Beta

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public static String getVersion() {
172172
private final long handle;
173173
private final Map<Class, String> dbNameByClass = new HashMap<>();
174174
private final Map<Class, Integer> entityTypeIdByClass = new HashMap<>();
175-
private final Map<Class, Properties> propertiesByClass = new HashMap<>();
175+
private final Map<Class, EntityInfo> propertiesByClass = new HashMap<>();
176176
private final LongHashMap<Class> classByEntityTypeId = new LongHashMap<>();
177177
private final int[] allEntityTypeIds;
178178
private final Map<Class, Box> boxes = new ConcurrentHashMap<>();
@@ -204,7 +204,7 @@ public static String getVersion() {
204204
handle = nativeCreate(directory.getAbsolutePath(), builder.maxSizeInKByte, builder.model);
205205
debugTx = builder.debugTransactions;
206206

207-
for (Properties entityInfo : builder.entityInfoList) {
207+
for (EntityInfo entityInfo : builder.entityInfoList) {
208208
try {
209209
dbNameByClass.put(entityInfo.getEntityClass(), entityInfo.getDbName());
210210
int entityId = nativeRegisterEntityClass(handle, entityInfo.getDbName(), entityInfo.getEntityClass());
@@ -282,7 +282,7 @@ Class getEntityClassOrThrow(int entityTypeId) {
282282
}
283283

284284
@Internal
285-
Properties getEntityInfo(Class entityClass) {
285+
EntityInfo getEntityInfo(Class entityClass) {
286286
return propertiesByClass.get(entityClass);
287287
}
288288

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class BoxStoreBuilder {
3232

3333
boolean debugTransactions;
3434

35-
final List<Properties> entityInfoList = new ArrayList<>();
35+
final List<EntityInfo> entityInfoList = new ArrayList<>();
3636

3737
public BoxStoreBuilder(byte[] model) {
3838
this.model = model;
@@ -107,8 +107,8 @@ public BoxStoreBuilder androidContext(Object context) {
107107
}
108108

109109
@Internal
110-
public <T> void entity(Properties properties) {
111-
entityInfoList.add(properties);
110+
public <T> void entity(EntityInfo entityInfo) {
111+
entityInfoList.add(entityInfo);
112112
}
113113

114114
// Not sure this will ever be implements

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,23 @@ protected static native long collect004000(long cursor, long keyIfComplete, int
9595

9696
protected Transaction tx;
9797
protected final long cursor;
98-
protected final Properties properties;
98+
protected final EntityInfo entityInfo;
9999
protected final BoxStore boxStoreForEntities;
100100

101101
protected boolean closed;
102102

103103
private final Throwable creationThrowable;
104104

105-
protected Cursor(Transaction tx, long cursor, Properties properties, BoxStore boxStore) {
105+
protected Cursor(Transaction tx, long cursor, EntityInfo entityInfo, BoxStore boxStore) {
106106
if (tx == null) {
107107
throw new IllegalArgumentException("Transaction is null");
108108
}
109109
this.tx = tx;
110110
this.cursor = cursor;
111-
this.properties = properties;
111+
this.entityInfo = entityInfo;
112112
this.boxStoreForEntities = boxStore;
113113

114-
Property[] allProperties = properties.getAllProperties();
114+
Property[] allProperties = entityInfo.getAllProperties();
115115
for (Property property : allProperties) {
116116
if (!property.isIdVerified()) {
117117
int id = getPropertyId(property.dbName);
@@ -137,8 +137,8 @@ protected void finalize() throws Throwable {
137137

138138
public abstract long put(T entity);
139139

140-
public Properties getProperties() {
141-
return properties;
140+
public EntityInfo getEntityInfo() {
141+
return entityInfo;
142142
}
143143

144144
public T get(long key) {

objectbox-java/src/main/java/io/objectbox/Properties.java renamed to objectbox-java/src/main/java/io/objectbox/EntityInfo.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
import io.objectbox.internal.IdGetter;
66

77
@Internal
8-
// TODO rename to EntityInfo (?)
9-
public interface Properties<T> {
8+
public interface EntityInfo<T> {
109
String getEntityName();
1110
String getDbName();
1211

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public KeyValueCursor createKeyValueCursor() {
127127

128128
public <T> Cursor<T> createCursor(Class<T> entityClass) {
129129
checkOpen();
130-
Properties entityInfo = store.getEntityInfo(entityClass);
130+
EntityInfo entityInfo = store.getEntityInfo(entityClass);
131131
CursorFactory<T> factory = entityInfo.getCursorFactory();
132132
long cursorHandle = nativeCreateCursor(transaction, entityInfo.getDbName(), entityClass);
133133
return factory.createCursor(this, cursorHandle, store);

tests/objectbox-java-test/src/main/java/io/objectbox/SimpleEntityInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import io.objectbox.internal.CursorFactory;
44
import io.objectbox.internal.IdGetter;
55

6-
public class SimpleEntityInfo<T> implements Properties<T> {
6+
public class SimpleEntityInfo<T> implements EntityInfo<T> {
77

88
String entityName;
99
String dbName;

tests/objectbox-java-test/src/main/java/io/objectbox/TestEntityCursor.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
package io.objectbox;
22

33

4-
import io.objectbox.BoxStore;
5-
import io.objectbox.Cursor;
6-
import io.objectbox.Properties;
7-
import io.objectbox.Transaction;
84
import io.objectbox.annotation.apihint.Internal;
9-
import io.objectbox.annotation.apihint.Temporary;
105
import io.objectbox.internal.CursorFactory;
116

127
// THIS CODE IS based on GENERATED code BY ObjectBox

tests/objectbox-java-test/src/main/java/io/objectbox/TestEntityMinimal_.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* Properties for entity "TestEntity". Can be used for QueryBuilder and for referencing DB names.
1313
*/
14-
public final class TestEntityMinimal_ implements Properties<TestEntityMinimal> {
14+
public final class TestEntityMinimal_ implements EntityInfo<TestEntityMinimal> {
1515

1616
// Leading underscores for static constants to avoid naming conflicts with property names
1717

tests/objectbox-java-test/src/main/java/io/objectbox/TestEntity_.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@
55

66
import io.objectbox.TestEntityCursor.Factory;
77

8-
import io.objectbox.Properties;
9-
import io.objectbox.Property;
108
import io.objectbox.annotation.apihint.Internal;
119
import io.objectbox.internal.CursorFactory;
1210
import io.objectbox.internal.IdGetter;
1311

1412
/**
1513
* Properties for entity "TestEntity". Can be used for QueryBuilder and for referencing DB names.
1614
*/
17-
public final class TestEntity_ implements Properties<TestEntity> {
15+
public final class TestEntity_ implements EntityInfo<TestEntity> {
1816

1917
// Leading underscores for static constants to avoid naming conflicts with property names
2018

0 commit comments

Comments
 (0)