Skip to content

Commit 79c5dc5

Browse files
committed
clean code
1 parent 0be41a8 commit 79c5dc5

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

src/main/java/com/redislabs/redisgraph/graph_entities/Node.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
public class Node extends GraphEntity {
1111

1212
//members
13-
final private List<String> labels = new ArrayList<>();
13+
private final List<String> labels = new ArrayList<>();
1414

1515
/**
1616
* @param label - a label to be add
@@ -32,7 +32,7 @@ public void removeLabel(String label) {
3232
* @throws IndexOutOfBoundsException if the index is out of range
3333
* ({@code index < 0 || index >= getNumberOfLabels()})
3434
*/
35-
public String getLabel(int index) throws IndexOutOfBoundsException{
35+
public String getLabel(int index){
3636
return labels.get(index);
3737
}
3838

src/main/java/com/redislabs/redisgraph/impl/Utils.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@
1515
* Utilities class
1616
*/
1717
public class Utils {
18-
public static final List<String> dummyList = new ArrayList<>(0);
19-
public static final Map<String, List<String>> dummyMap = new HashMap<>(0);
20-
public static final String compactString = "--COMPACT";
21-
22-
18+
public static final List<String> DUMMY_LIST = new ArrayList<>(0);
19+
public static final Map<String, List<String>> DUMMY_MAP = new HashMap<>(0);
20+
public static final String COMPACT_STRING = "--COMPACT";
2321

2422
private static final CharSequenceTranslator ESCAPE_CHYPER;
2523
static {
@@ -28,6 +26,8 @@ public class Utils {
2826
escapeJavaMap.put("\"", "\\\"");
2927
ESCAPE_CHYPER = new AggregateTranslator(new LookupTranslator(Collections.unmodifiableMap(escapeJavaMap)));
3028
}
29+
30+
private Utils() {}
3131

3232
/**
3333
*

src/main/java/com/redislabs/redisgraph/impl/api/AbstractRedisGraph.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ public ResultSet query(String graphId, String query, Object ...args) {
4343

4444

4545
public ResultSet callProcedure(String graphId, String procedure){
46-
return callProcedure(graphId, procedure, Utils.dummyList, Utils.dummyMap);
46+
return callProcedure(graphId, procedure, Utils.DUMMY_LIST, Utils.DUMMY_MAP);
4747
}
4848

4949
public ResultSet callProcedure(String graphId, String procedure, List<String> args){
50-
return callProcedure(graphId, procedure, args, Utils.dummyMap);
50+
return callProcedure(graphId, procedure, args, Utils.DUMMY_MAP);
5151
}
5252

5353
public ResultSet callProcedure(String graphId, String procedure, List<String> args , Map<String, List<String>> kwargs){

src/main/java/com/redislabs/redisgraph/impl/api/ContextedRedisGraph.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ protected ResultSet sendQuery(String graphId, String preparedQuery) {
4848
Jedis conn = getConnection();
4949
List<Object> rawResponse;
5050
try {
51-
rawResponse = (List<Object>) conn.sendCommand(RedisGraphCommand.QUERY, graphId, preparedQuery, Utils.compactString);
51+
rawResponse = (List<Object>) conn.sendCommand(RedisGraphCommand.QUERY, graphId, preparedQuery, Utils.COMPACT_STRING);
5252
}
5353
catch (Exception e) {
5454
conn.close();
5555
throw e;
5656
}
57-
return new ResultSetImpl(rawResponse, this, graphId, caches.getGraphCache(graphId));
57+
return new ResultSetImpl(rawResponse, this, caches.getGraphCache(graphId));
5858
}
5959

6060
/**

src/main/java/com/redislabs/redisgraph/impl/api/RedisGraphTransaction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public ResultSet build(Object o) {
5757
* @return response with result set with the procedure data
5858
*/
5959
public Response<ResultSet> callProcedure(String graphId, String procedure){
60-
return callProcedure(graphId, procedure, Utils.dummyList, Utils.dummyMap);
60+
return callProcedure(graphId, procedure, Utils.DUMMY_LIST, Utils.DUMMY_MAP);
6161
}
6262

6363
/**
@@ -68,7 +68,7 @@ public Response<ResultSet> callProcedure(String graphId, String procedure){
6868
* @return response with result set with the procedure data
6969
*/
7070
public Response<ResultSet> callProcedure(String graphId, String procedure, List<String> args ){
71-
return callProcedure(graphId, procedure, args, Utils.dummyMap);
71+
return callProcedure(graphId, procedure, args, Utils.DUMMY_MAP);
7272
}
7373

7474

0 commit comments

Comments
 (0)