Skip to content

Commit

Permalink
deprecated DbName (DE-508)
Browse files Browse the repository at this point in the history
  • Loading branch information
rashtao committed Apr 19, 2023
1 parent 08f31ed commit dda8575
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 22 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

## [Unreleased]

- deprecated `DbName` in favor of plain strings

## [6.22.0] - 2023-04-18

- added support to `forceOneShardAttributeValue` query parameter (DE-541)
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/arangodb/ArangoDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -753,9 +753,7 @@ public synchronized ArangoDB build() {
*
* @param name Name of the database
* @return database handler
* @deprecated Use {@link #db(DbName)} instead
*/
@Deprecated
default ArangoDatabase db(String name) {
return db(DbName.of(name));
}
Expand All @@ -765,7 +763,9 @@ default ArangoDatabase db(String name) {
*
* @param dbName Name of the database
* @return database handler
* @deprecated Use {@link #db(String)} instead
*/
@Deprecated
ArangoDatabase db(DbName dbName);

/**
Expand All @@ -781,9 +781,7 @@ default ArangoDatabase db(String name) {
* @throws ArangoDBException
* @see <a href="https://www.arangodb.com/docs/stable/http/database-database-management.html#create-database">API
* Documentation</a>
* @deprecated Use {@link #createDatabase(DbName)} instead
*/
@Deprecated
default Boolean createDatabase(String name) throws ArangoDBException {
return createDatabase(DbName.of(name));
}
Expand All @@ -796,7 +794,9 @@ default Boolean createDatabase(String name) throws ArangoDBException {
* @throws ArangoDBException
* @see <a href="https://www.arangodb.com/docs/stable/http/database-database-management.html#create-database">API
* Documentation</a>
* @deprecated Use {@link #createDatabase(String)} instead
*/
@Deprecated
Boolean createDatabase(DbName dbName) throws ArangoDBException;

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/arangodb/ArangoDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ public interface ArangoDatabase extends ArangoSerializationAccessor {
* Returns the name of the database
*
* @return database name
* @deprecated Use {@link #dbName()} instead
*/
@Deprecated
default String name() {
return dbName().get();
}
Expand All @@ -66,7 +64,9 @@ default String name() {
* Returns the name of the database
*
* @return database name
* @deprecated Use {@link #name()} instead
*/
@Deprecated
DbName dbName();

/**
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/arangodb/DbName.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
*
* @see <a href="http://https://www.arangodb.com/docs/stable/data-modeling-naming-conventions-database-names.html">
* API Documentation</a>
*
* @deprecated This class is deprecated and will be removed in a future release. Use plain String instead.
* Wrapper classes for data definition names are not required anymore, since ArangoDB throws an error if a name is
* not NFC-normalized.
*/
@Deprecated
public final class DbName implements Supplier<String> {

/**
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/arangodb/async/ArangoDBAsync.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ public interface ArangoDBAsync extends ArangoSerializationAccessor {
*
* @param name Name of the database
* @return database handler
* @deprecated Use {@link #db(DbName)} instead
*/
@Deprecated
default ArangoDatabaseAsync db(final String name) {
return db(DbName.of(name));
}
Expand All @@ -108,7 +106,9 @@ default ArangoDatabaseAsync db(final String name) {
*
* @param dbName Name of the database
* @return database handler
* @deprecated Use {@link #db(String)} instead
*/
@Deprecated
ArangoDatabaseAsync db(final DbName dbName);

/**
Expand All @@ -123,9 +123,7 @@ default ArangoDatabaseAsync db(final String name) {
* @return true if the database was created successfully.
* @see <a href="https://www.arangodb.com/docs/stable/http/database-database-management.html#create-database">API
* Documentation</a>
* @deprecated Use {@link #createDatabase(DbName)} instead
*/
@Deprecated
default CompletableFuture<Boolean> createDatabase(final String name) {
return createDatabase(DbName.of(name));
}
Expand All @@ -137,7 +135,9 @@ default CompletableFuture<Boolean> createDatabase(final String name) {
* @return true if the database was created successfully.
* @see <a href="https://www.arangodb.com/docs/stable/http/database-database-management.html#create-database">API
* Documentation</a>
* @deprecated Use {@link #createDatabase(String)} instead
*/
@Deprecated
CompletableFuture<Boolean> createDatabase(final DbName dbName);

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/arangodb/async/ArangoDatabaseAsync.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ public interface ArangoDatabaseAsync extends ArangoSerializationAccessor {
* Returns the name of the database
*
* @return database name
* @deprecated Use {@link #dbName()} instead
*/
@Deprecated
default String name() {
return dbName().get();
}
Expand All @@ -69,7 +67,9 @@ default String name() {
* Returns the name of the database
*
* @return database name
* @deprecated Use {@link #name()} instead
*/
@Deprecated
DbName dbName();

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/arangodb/model/DBCreateOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ public String getName() {
/**
* @param name Has to contain a valid database name
* @return options
* @deprecated Use {@link #name(DbName)} instead.
*/
@Deprecated
public DBCreateOptions name(final String name) {
return name(DbName.of(name));
}

/**
* @param dbName database name
* @return options
* @deprecated Use {@link #name(String)} instead.
*/
@Deprecated
public DBCreateOptions name(final DbName dbName) {
name = dbName.get();
return this;
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/com/arangodb/velocystream/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ public class Request {
@Expose(serialize = false)
private VPackSlice body;

/**
* @deprecated Use {@link #Request(DbName, RequestType, String)} instead
*/
@Deprecated
public Request(final String database, final RequestType requestType, final String path) {
this(DbName.of(database), requestType, path);
}

/**
* @deprecated Use {@link #Request(String, RequestType, String)} instead
*/
@Deprecated
public Request(final DbName dbName, final RequestType requestType, final String path) {
super();
this.dbName = dbName;
Expand Down Expand Up @@ -78,14 +78,14 @@ public Request setType(final int type) {
return this;
}

/**
* @deprecated Use {@link #getDbName()} instead
*/
@Deprecated
public String getDatabase() {
return getDbName().get();
}

/**
* @deprecated Use {@link #getDatabase()} instead
*/
@Deprecated
public DbName getDbName() {
return dbName;
}
Expand Down

0 comments on commit dda8575

Please sign in to comment.