Skip to content

Commit 62d64f9

Browse files
committed
code-style refactoring, fix Javadoc warnings
1 parent 27a2a16 commit 62d64f9

15 files changed

+264
-265
lines changed

src/main/java/com/arangodb/ArangoCollection.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,6 @@ <T> MultiDocumentEntity<DocumentUpdateEntity<T>> updateDocuments(
368368
* Documentation</a>
369369
* @param key
370370
* The key of the document
371-
* @param type
372-
* The type of the document (POJO class, VPackSlice or String for JSON). Only necessary if
373-
* options.returnOld is set to true, otherwise can be null.
374-
* @param options
375-
* Additional options, can be null
376371
* @return information about the document
377372
* @throws ArangoDBException
378373
*/
@@ -404,9 +399,6 @@ <T> DocumentDeleteEntity<T> deleteDocument(String key, Class<T> type, DocumentDe
404399
* Documentation</a>
405400
* @param values
406401
* The keys of the documents or the documents themselves
407-
* @param type
408-
* The type of the documents (POJO class, VPackSlice or String for JSON). Only necessary if
409-
* options.returnOld is set to true, otherwise can be null.
410402
* @return information about the documents
411403
* @throws ArangoDBException
412404
*/

src/main/java/com/arangodb/ArangoDB.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -603,9 +603,10 @@ public synchronized ArangoDB build() {
603603
final ArangoSerialization custom = customSerializer != null ? customSerializer : internal;
604604
final ArangoSerializationFactory util = new ArangoSerializationFactory(internal, custom);
605605

606-
final int max = maxConnections != null ? Math.max(1, maxConnections)
607-
: protocol == Protocol.VST ? ArangoDefaults.MAX_CONNECTIONS_VST_DEFAULT
608-
: ArangoDefaults.MAX_CONNECTIONS_HTTP_DEFAULT;
606+
int protocolMaxConnections = protocol == Protocol.VST ?
607+
ArangoDefaults.MAX_CONNECTIONS_VST_DEFAULT :
608+
ArangoDefaults.MAX_CONNECTIONS_HTTP_DEFAULT;
609+
final int max = maxConnections != null ? Math.max(1, maxConnections) : protocolMaxConnections;
609610

610611
final ConnectionFactory connectionFactory = (protocol == null || Protocol.VST == protocol)
611612
? new VstConnectionFactorySync(host, timeout, connectionTtl, useSsl, sslContext)
@@ -688,7 +689,7 @@ public synchronized ArangoDB build() {
688689
* Documentation</a>
689690
* @param user
690691
* The name of the user for which you want to query the databases
691-
* @return
692+
* @return list of database names which are available for the specified user
692693
* @throws ArangoDBException
693694
*/
694695
Collection<String> getAccessibleDatabasesFor(String user) throws ArangoDBException;

src/main/java/com/arangodb/ArangoDBException.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,32 @@
2929
public class ArangoDBException extends RuntimeException {
3030

3131
private static final long serialVersionUID = 6165638002614173801L;
32-
private ErrorEntity entity = null;
33-
private Integer responseCode;
32+
private final ErrorEntity entity;
33+
private final Integer responseCode;
3434

3535
public ArangoDBException(final ErrorEntity errorEntity) {
3636
super(String.format("Response: %s, Error: %s - %s", errorEntity.getCode(), errorEntity.getErrorNum(),
3737
errorEntity.getErrorMessage()));
3838
this.entity = errorEntity;
39+
this.responseCode = null;
3940
}
4041

4142
public ArangoDBException(final String message) {
4243
super(message);
44+
this.entity = null;
45+
this.responseCode = null;
4346
}
4447

4548
public ArangoDBException(final String message, final Integer responseCode) {
4649
super(message);
50+
this.entity = null;
4751
this.responseCode = responseCode;
4852
}
4953

5054
public ArangoDBException(final Throwable cause) {
5155
super(cause);
56+
this.entity = null;
57+
this.responseCode = null;
5258
}
5359

5460
/**
@@ -69,7 +75,8 @@ public String getException() {
6975
* @return HTTP response code
7076
*/
7177
public Integer getResponseCode() {
72-
return responseCode != null ? responseCode : entity != null ? entity.getCode() : null;
78+
Integer entityResponseCode = entity != null ? entity.getCode() : null;
79+
return responseCode != null ? responseCode : entityResponseCode;
7380
}
7481

7582
/**

src/main/java/com/arangodb/ArangoEdgeCollection.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public interface ArangoEdgeCollection extends ArangoSerializationAccessor {
109109
* @see <a href="https://docs.arangodb.com/current/HTTP/Gharial/Edges.html#replace-an-edge">API Documentation</a>
110110
* @param key
111111
* The key of the edge
112-
* @param type
112+
* @param <T>
113113
* The type of the edge-document (POJO class, VPackSlice or String for JSON)
114114
* @return information about the edge
115115
* @throws ArangoDBException
@@ -123,7 +123,7 @@ public interface ArangoEdgeCollection extends ArangoSerializationAccessor {
123123
* @see <a href="https://docs.arangodb.com/current/HTTP/Gharial/Edges.html#replace-an-edge">API Documentation</a>
124124
* @param key
125125
* The key of the edge
126-
* @param type
126+
* @param <T>
127127
* The type of the edge-document (POJO class, VPackSlice or String for JSON)
128128
* @param options
129129
* Additional options, can be null
@@ -140,7 +140,7 @@ public interface ArangoEdgeCollection extends ArangoSerializationAccessor {
140140
* @see <a href="https://docs.arangodb.com/current/HTTP/Gharial/Edges.html#modify-an-edge">API Documentation</a>
141141
* @param key
142142
* The key of the edge
143-
* @param type
143+
* @param <T>
144144
* The type of the edge-document (POJO class, VPackSlice or String for JSON)
145145
* @return information about the edge
146146
* @throws ArangoDBException
@@ -155,7 +155,7 @@ public interface ArangoEdgeCollection extends ArangoSerializationAccessor {
155155
* @see <a href="https://docs.arangodb.com/current/HTTP/Gharial/Edges.html#modify-an-edge">API Documentation</a>
156156
* @param key
157157
* The key of the edge
158-
* @param type
158+
* @param <T>
159159
* The type of the edge-document (POJO class, VPackSlice or String for JSON)
160160
* @param options
161161
* Additional options, can be null

src/main/java/com/arangodb/ArangoGraph.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ public interface ArangoGraph extends ArangoSerializationAccessor {
3939
*
4040
* @return database handler
4141
*/
42-
public ArangoDatabase db();
42+
ArangoDatabase db();
4343

4444
/**
4545
* The name of the collection
4646
*
4747
* @return collection name
4848
*/
49-
public String name();
49+
String name();
5050

5151
/**
5252
* Checks whether the graph exists

src/main/java/com/arangodb/ArangoVertexCollection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public interface ArangoVertexCollection extends ArangoSerializationAccessor {
152152
* @see <a href="https://docs.arangodb.com/current/HTTP/Gharial/Vertices.html#modify-a-vertex">API Documentation</a>
153153
* @param key
154154
* The key of the vertex
155-
* @param type
155+
* @param <T>
156156
* The type of the vertex-document (POJO class, VPackSlice or String for JSON)
157157
* @return information about the vertex
158158
* @throws ArangoDBException
@@ -167,7 +167,7 @@ public interface ArangoVertexCollection extends ArangoSerializationAccessor {
167167
* @see <a href="https://docs.arangodb.com/current/HTTP/Gharial/Vertices.html#modify-a-vertex">API Documentation</a>
168168
* @param key
169169
* The key of the vertex
170-
* @param type
170+
* @param <T>
171171
* The type of the vertex-document (POJO class, VPackSlice or String for JSON)
172172
* @param options
173173
* Additional options, can be null

src/main/java/com/arangodb/ArangoView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ public interface ArangoView extends ArangoSerializationAccessor {
3636
*
3737
* @return database handler
3838
*/
39-
public ArangoDatabase db();
39+
ArangoDatabase db();
4040

4141
/**
4242
* The name of the view
4343
*
4444
* @return view name
4545
*/
46-
public String name();
46+
String name();
4747

4848
/**
4949
* Checks whether the view exists.
Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
1-
/*
2-
* DISCLAIMER
3-
*
4-
* Copyright 2016 ArangoDB GmbH, Cologne, Germany
5-
*
6-
* Licensed under the Apache License, Version 2.0 (the "License");
7-
* you may not use this file except in compliance with the License.
8-
* You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing, software
13-
* distributed under the License is distributed on an "AS IS" BASIS,
14-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
* See the License for the specific language governing permissions and
16-
* limitations under the License.
17-
*
18-
* Copyright holder is ArangoDB GmbH, Cologne, Germany
19-
*/
20-
21-
package com.arangodb.entity;
22-
23-
/**
24-
* @author Mark Vollmary
25-
*
26-
*/
27-
public enum CollectionStatus {
28-
29-
NEW_BORN_COLLECTION(1), UNLOADED(2), LOADED(3), IN_THE_PROCESS_OF_BEING_UNLOADED(4), DELETED(5);
30-
31-
private final int status;
32-
33-
private CollectionStatus(final int status) {
34-
this.status = status;
35-
}
36-
37-
public int getStatus() {
38-
return status;
39-
}
40-
41-
public static CollectionStatus fromStatus(final int status) {
42-
for (final CollectionStatus cStatus : CollectionStatus.values()) {
43-
if (cStatus.status == status) {
44-
return cStatus;
45-
}
46-
}
47-
return null;
48-
}
49-
50-
}
1+
/*
2+
* DISCLAIMER
3+
*
4+
* Copyright 2016 ArangoDB GmbH, Cologne, Germany
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
* Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
*/
20+
21+
package com.arangodb.entity;
22+
23+
/**
24+
* @author Mark Vollmary
25+
*
26+
*/
27+
public enum CollectionStatus {
28+
29+
NEW_BORN_COLLECTION(1), UNLOADED(2), LOADED(3), IN_THE_PROCESS_OF_BEING_UNLOADED(4), DELETED(5);
30+
31+
private final int status;
32+
33+
CollectionStatus(final int status) {
34+
this.status = status;
35+
}
36+
37+
public int getStatus() {
38+
return status;
39+
}
40+
41+
public static CollectionStatus fromStatus(final int status) {
42+
for (final CollectionStatus cStatus : CollectionStatus.values()) {
43+
if (cStatus.status == status) {
44+
return cStatus;
45+
}
46+
}
47+
return null;
48+
}
49+
50+
}
Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
1-
/*
2-
* DISCLAIMER
3-
*
4-
* Copyright 2016 ArangoDB GmbH, Cologne, Germany
5-
*
6-
* Licensed under the Apache License, Version 2.0 (the "License");
7-
* you may not use this file except in compliance with the License.
8-
* You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing, software
13-
* distributed under the License is distributed on an "AS IS" BASIS,
14-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
* See the License for the specific language governing permissions and
16-
* limitations under the License.
17-
*
18-
* Copyright holder is ArangoDB GmbH, Cologne, Germany
19-
*/
20-
21-
package com.arangodb.entity;
22-
23-
/**
24-
* @author Mark Vollmary
25-
*
26-
*/
27-
public enum CollectionType {
28-
29-
DOCUMENT(2), EDGES(3);
30-
31-
private final int type;
32-
33-
private CollectionType(final int type) {
34-
this.type = type;
35-
}
36-
37-
public int getType() {
38-
return type;
39-
}
40-
41-
public static CollectionType fromType(final int type) {
42-
for (final CollectionType cType : CollectionType.values()) {
43-
if (cType.type == type) {
44-
return cType;
45-
}
46-
}
47-
return null;
48-
}
49-
}
1+
/*
2+
* DISCLAIMER
3+
*
4+
* Copyright 2016 ArangoDB GmbH, Cologne, Germany
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
* Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
*/
20+
21+
package com.arangodb.entity;
22+
23+
/**
24+
* @author Mark Vollmary
25+
*
26+
*/
27+
public enum CollectionType {
28+
29+
DOCUMENT(2), EDGES(3);
30+
31+
private final int type;
32+
33+
CollectionType(final int type) {
34+
this.type = type;
35+
}
36+
37+
public int getType() {
38+
return type;
39+
}
40+
41+
public static CollectionType fromType(final int type) {
42+
for (final CollectionType cType : CollectionType.values()) {
43+
if (cType.type == type) {
44+
return cType;
45+
}
46+
}
47+
return null;
48+
}
49+
}

src/main/java/com/arangodb/entity/ErrorEntity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public String getErrorMessage() {
4848

4949
/**
5050
* @return the exception message, passed when transaction fails
51-
* @return
5251
*/
5352
public String getException() {
5453
return exception;

0 commit comments

Comments
 (0)