Skip to content

Commit c897c28

Browse files
Merge branch '279-remove-deprecated-apis' into 'dev'
Remove some deprecated APIs #279 See merge request objectbox/objectbox-java!162
2 parents d288801 + 7873346 commit c897c28

File tree

11 files changed

+12
-354
lines changed

11 files changed

+12
-354
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ For more insights into what changed in the ObjectBox C++ core, [check the Object
1212
- When using `BoxStoreBuilder.buildDefault()`, don't leak Store when setting as default fails.
1313
- To help diagnose, print stacks of all threads in the internal thread pool if shutting it down takes too long when
1414
closing `BoxStore`.
15+
- Remove deprecated `Query.setParameters` methods that set a single parameter, use the `setParameter` methods instead.
16+
- Remove deprecated `Box.removeByKeys`, use `Box.removeByIds` instead.
17+
- Remove deprecated `BoxStore.sizeOnDisk`, use `getDbSize` or `getDbSizeOnDisk` instead which properly handle in-memory databases.
18+
- Remove deprecated `BoxStoreBuilder.debugTransactions`, use `debugFlags(DebugFlags.LOG_TRANSACTIONS_READ | DebugFlags.LOG_TRANSACTIONS_WRITE)` instead.
19+
- Remove deprecated `SyncServerBuilder` `peer` configuration options, use the `clusterPeer` options instead.
20+
- Remove deprecated `io.objectbox.DebugFlags`, use `io.objectbox.config.DebugFlags` instead.
21+
- Remove deprecated `ValidateOnOpenMode` constants, use `ValidateOnOpenModePages` instead.
22+
- Remove deprecated DAOcompat compatibility query methods. Use the regular query API instead.
1523

1624
## 4.3.1 - 2025-08-12
1725

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -485,14 +485,6 @@ public void remove(@Nullable long... ids) {
485485
}
486486
}
487487

488-
/**
489-
* @deprecated use {@link #removeByIds(Collection)} instead.
490-
*/
491-
@Deprecated
492-
public void removeByKeys(@Nullable Collection<Long> ids) {
493-
removeByIds(ids);
494-
}
495-
496488
/**
497489
* Like {@link #remove(long)}, but removes multiple objects in a single transaction.
498490
*/

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -513,17 +513,6 @@ public static long sysProcStatusKb(String key) {
513513
return nativeSysProcStatusKb(key);
514514
}
515515

516-
/**
517-
* The size in bytes occupied by the data file on disk.
518-
*
519-
* @return 0 if the size could not be determined (does not throw unless this store was already closed)
520-
* @deprecated Use {@link #getDbSize()} or {@link #getDbSizeOnDisk()} instead which properly handle in-memory databases.
521-
*/
522-
@Deprecated
523-
public long sizeOnDisk() {
524-
return getDbSize();
525-
}
526-
527516
/**
528517
* Get the size of this store. For a disk-based store type, this corresponds to the size on disk, and for the
529518
* in-memory store type, this is roughly the used memory bytes occupied by the data.

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2024 ObjectBox Ltd.
2+
* Copyright 2017-2025 ObjectBox Ltd.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -512,15 +512,6 @@ public BoxStoreBuilder validateOnOpenKv(short mode) {
512512
return this;
513513
}
514514

515-
/**
516-
* @deprecated Use {@link #debugFlags} instead.
517-
*/
518-
@Deprecated
519-
public BoxStoreBuilder debugTransactions() {
520-
this.debugFlags |= DebugFlags.LOG_TRANSACTIONS_READ | DebugFlags.LOG_TRANSACTIONS_WRITE;
521-
return this;
522-
}
523-
524515
/**
525516
* Debug flags typically enable additional logging, see {@link DebugFlags} for valid values.
526517
* <p>

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

Lines changed: 0 additions & 50 deletions
This file was deleted.

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

Lines changed: 2 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package io.objectbox;
1818

1919
import java.io.Serializable;
20-
import java.util.Collection;
2120
import java.util.Date;
2221

2322
import javax.annotation.Nullable;
@@ -39,9 +38,9 @@
3938
import io.objectbox.query.PropertyQueryConditionImpl.StringArrayCondition;
4039
import io.objectbox.query.PropertyQueryConditionImpl.StringCondition;
4140
import io.objectbox.query.PropertyQueryConditionImpl.StringCondition.Operation;
42-
import io.objectbox.query.PropertyQueryConditionImpl.StringStringCondition;
43-
import io.objectbox.query.PropertyQueryConditionImpl.StringLongCondition;
4441
import io.objectbox.query.PropertyQueryConditionImpl.StringDoubleCondition;
42+
import io.objectbox.query.PropertyQueryConditionImpl.StringLongCondition;
43+
import io.objectbox.query.PropertyQueryConditionImpl.StringStringCondition;
4544
import io.objectbox.query.Query;
4645
import io.objectbox.query.QueryBuilder.StringOrder;
4746

@@ -721,133 +720,6 @@ public PropertyQueryCondition<ENTITY> lessOrEqual(byte[] value) {
721720
return new ByteArrayCondition<>(this, ByteArrayCondition.Operation.LESS_OR_EQUAL, value);
722721
}
723722

724-
//////
725-
// Note: The following are deprecated conditions used with DAOcompat only.
726-
// They exist so library users need not update their code where new conditions are named differently.
727-
//////
728-
729-
/**
730-
* Creates an "equal ('=')" condition for this property.
731-
*
732-
* @deprecated Use {@link #equal} instead.
733-
*/
734-
@Deprecated
735-
public PropertyQueryCondition<ENTITY> eq(Object value) {
736-
if (value instanceof Long) {
737-
return equal((Long) value);
738-
} else if (value instanceof Integer) {
739-
return equal((Integer) value);
740-
} else if (value instanceof String) {
741-
return equal((String) value);
742-
} else {
743-
throw new IllegalArgumentException("Only LONG, INTEGER or STRING values are supported.");
744-
}
745-
}
746-
747-
/**
748-
* Creates an "not equal ('&lt;&gt;')" condition for this property.
749-
*
750-
* @deprecated Use {@link #notEqual} instead.
751-
*/
752-
@Deprecated
753-
public PropertyQueryCondition<ENTITY> notEq(Object value) {
754-
if (value instanceof Long) {
755-
return notEqual((Long) value);
756-
} else if (value instanceof Integer) {
757-
return notEqual((Integer) value);
758-
} else if (value instanceof String) {
759-
return notEqual((String) value);
760-
} else {
761-
throw new IllegalArgumentException("Only LONG, INTEGER or STRING values are supported.");
762-
}
763-
}
764-
765-
/**
766-
* Creates an "IN (..., ..., ...)" condition for this property.
767-
*
768-
* @deprecated Use {@link #oneOf} instead.
769-
*/
770-
@Deprecated
771-
public PropertyQueryCondition<ENTITY> in(Object... values) {
772-
// just check the first value and assume all others are of the same type
773-
// maybe this is too naive and we should properly check values earlier
774-
if (values[0] instanceof Long) {
775-
long[] inValues = new long[values.length];
776-
for (int i = 0; i < values.length; i++) {
777-
inValues[i] = (long) values[i];
778-
}
779-
return oneOf(inValues);
780-
} else if (values[0] instanceof Integer) {
781-
int[] inValues = new int[values.length];
782-
for (int i = 0; i < values.length; i++) {
783-
inValues[i] = (int) values[i];
784-
}
785-
return oneOf(inValues);
786-
} else {
787-
throw new IllegalArgumentException("The IN condition only supports LONG or INTEGER values.");
788-
}
789-
}
790-
791-
/**
792-
* Creates an "IN (..., ..., ...)" condition for this property.
793-
*
794-
* @deprecated Use {@link #oneOf} instead.
795-
*/
796-
@Deprecated
797-
public PropertyQueryCondition<ENTITY> in(Collection<?> inValues) {
798-
return in(inValues.toArray());
799-
}
800-
801-
/**
802-
* Creates an "greater than ('&gt;')" condition for this property.
803-
*
804-
* @deprecated Use {@link #greater} instead.
805-
*/
806-
@Deprecated
807-
public PropertyQueryCondition<ENTITY> gt(Object value) {
808-
if (value instanceof Long) {
809-
return greater((Long) value);
810-
} else if (value instanceof Integer) {
811-
return greater((Integer) value);
812-
} else if (value instanceof Double) {
813-
return greater((Double) value);
814-
} else if (value instanceof Float) {
815-
return greater((Float) value);
816-
} else {
817-
throw new IllegalArgumentException("Only LONG, INTEGER, DOUBLE or FLOAT values are supported.");
818-
}
819-
}
820-
821-
/**
822-
* Creates an "less than ('&lt;')" condition for this property.
823-
*
824-
* @deprecated Use {@link #less} instead.
825-
*/
826-
@Deprecated
827-
public PropertyQueryCondition<ENTITY> lt(Object value) {
828-
if (value instanceof Long) {
829-
return less((Long) value);
830-
} else if (value instanceof Integer) {
831-
return less((Integer) value);
832-
} else if (value instanceof Double) {
833-
return less((Double) value);
834-
} else if (value instanceof Float) {
835-
return less((Float) value);
836-
} else {
837-
throw new IllegalArgumentException("Only LONG, INTEGER, DOUBLE or FLOAT values are supported.");
838-
}
839-
}
840-
841-
/**
842-
* Creates an "IS NOT NULL" condition for this property.
843-
*
844-
* @deprecated Use {@link #notNull()} instead.
845-
*/
846-
@Deprecated
847-
public PropertyQueryCondition<ENTITY> isNotNull() {
848-
return notNull();
849-
}
850-
851723
@Internal
852724
public int getEntityId() {
853725
return entity.getEntityId();

objectbox-java/src/main/java/io/objectbox/model/ValidateOnOpenMode.java

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)