Skip to content

Commit 844477c

Browse files
authored
run formatter (#2416)
1 parent c9ba33b commit 844477c

File tree

106 files changed

+2890
-2519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+2890
-2519
lines changed

src/main/java/redis/clients/jedis/AccessControlLogEntry.java

Lines changed: 89 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -4,107 +4,97 @@
44
import java.util.*;
55

66
/**
7-
* This class holds information about an Access Control Log entry (returned by ACL LOG command)
8-
* They can be access via getters.
9-
* For future purpose there is also {@link #getlogEntry} method
10-
* that returns a generic {@code Map} - in case where more info is returned from a server
11-
*
7+
* This class holds information about an Access Control Log entry (returned by ACL LOG command) They
8+
* can be access via getters. For future purpose there is also {@link #getlogEntry} method that
9+
* returns a generic {@code Map} - in case where more info is returned from a server
1210
*/
1311
public class AccessControlLogEntry implements Serializable {
1412

15-
private static final long serialVersionUID = 1L;
16-
17-
public static final String COUNT = "count";
18-
public static final String REASON = "reason";
19-
public static final String CONTEXT = "context";
20-
public static final String OBJECT = "object";
21-
public static final String USERNAME = "username";
22-
public static final String AGE_SECONDS = "age-seconds";
23-
public static final String CLIENT_INFO = "client-info";
24-
25-
private long count;
26-
private final String reason;
27-
private final String context;
28-
private final String object;
29-
private final String username;
30-
private final String ageSeconds;
31-
private final Map<String,String> clientInfo;
32-
private final Map<String,Object> logEntry;
33-
34-
35-
public AccessControlLogEntry(Map<String, Object> map) {
36-
count = (long)map.get(COUNT);
37-
reason = (String)map.get(REASON);
38-
context = (String)map.get(CONTEXT);
39-
object = (String)map.get(OBJECT);
40-
username = (String)map.get(USERNAME);
41-
ageSeconds = (String)map.get(AGE_SECONDS);
42-
clientInfo = getMapFromRawClientInfo((String)map.get(CLIENT_INFO));
43-
logEntry = map;
44-
}
45-
46-
public long getCount() {
47-
return count;
48-
}
49-
50-
public String getReason() {
51-
return reason;
52-
}
53-
54-
public String getContext() {
55-
return context;
56-
}
57-
58-
public String getObject() {
59-
return object;
60-
}
61-
62-
public String getUsername() {
63-
return username;
64-
}
65-
66-
public String getAgeSeconds() {
67-
return ageSeconds;
68-
}
69-
70-
public Map<String, String> getClientInfo() {
71-
return clientInfo;
72-
}
73-
74-
/**
75-
* @return Generic map containing all key-value pairs returned by the server
76-
*/
77-
public Map<String,Object> getlogEntry() {
78-
return logEntry;
79-
}
80-
81-
/**
82-
* Convert the client-info string into a Map of String.
83-
* When the value is empty, the value in the map is set to an empty string
84-
* The key order is maintained to reflect the string return by Redis
85-
* @param clientInfo
86-
* @return A Map with all client info
87-
*/
88-
private Map<String,String> getMapFromRawClientInfo( String clientInfo) {
89-
String[] entries = clientInfo.split(" ");
90-
Map<String,String> clientInfoMap = new LinkedHashMap<>(entries.length);
91-
for (String entry : entries) {
92-
String[] kvArray = entry.split("=");
93-
clientInfoMap.put(kvArray[0], (kvArray.length ==2)?kvArray[1]:"" );
94-
}
95-
return clientInfoMap;
96-
}
97-
98-
@Override
99-
public String toString() {
100-
return "AccessControlLogEntry{" +
101-
"count=" + count +
102-
", reason='" + reason + '\'' +
103-
", context='" + context + '\'' +
104-
", object='" + object + '\'' +
105-
", username='" + username + '\'' +
106-
", ageSeconds='" + ageSeconds + '\'' +
107-
", clientInfo=" + clientInfo +
108-
'}';
13+
private static final long serialVersionUID = 1L;
14+
15+
public static final String COUNT = "count";
16+
public static final String REASON = "reason";
17+
public static final String CONTEXT = "context";
18+
public static final String OBJECT = "object";
19+
public static final String USERNAME = "username";
20+
public static final String AGE_SECONDS = "age-seconds";
21+
public static final String CLIENT_INFO = "client-info";
22+
23+
private long count;
24+
private final String reason;
25+
private final String context;
26+
private final String object;
27+
private final String username;
28+
private final String ageSeconds;
29+
private final Map<String, String> clientInfo;
30+
private final Map<String, Object> logEntry;
31+
32+
public AccessControlLogEntry(Map<String, Object> map) {
33+
count = (long) map.get(COUNT);
34+
reason = (String) map.get(REASON);
35+
context = (String) map.get(CONTEXT);
36+
object = (String) map.get(OBJECT);
37+
username = (String) map.get(USERNAME);
38+
ageSeconds = (String) map.get(AGE_SECONDS);
39+
clientInfo = getMapFromRawClientInfo((String) map.get(CLIENT_INFO));
40+
logEntry = map;
41+
}
42+
43+
public long getCount() {
44+
return count;
45+
}
46+
47+
public String getReason() {
48+
return reason;
49+
}
50+
51+
public String getContext() {
52+
return context;
53+
}
54+
55+
public String getObject() {
56+
return object;
57+
}
58+
59+
public String getUsername() {
60+
return username;
61+
}
62+
63+
public String getAgeSeconds() {
64+
return ageSeconds;
65+
}
66+
67+
public Map<String, String> getClientInfo() {
68+
return clientInfo;
69+
}
70+
71+
/**
72+
* @return Generic map containing all key-value pairs returned by the server
73+
*/
74+
public Map<String, Object> getlogEntry() {
75+
return logEntry;
76+
}
77+
78+
/**
79+
* Convert the client-info string into a Map of String. When the value is empty, the value in the
80+
* map is set to an empty string The key order is maintained to reflect the string return by Redis
81+
* @param clientInfo
82+
* @return A Map with all client info
83+
*/
84+
private Map<String, String> getMapFromRawClientInfo(String clientInfo) {
85+
String[] entries = clientInfo.split(" ");
86+
Map<String, String> clientInfoMap = new LinkedHashMap<>(entries.length);
87+
for (String entry : entries) {
88+
String[] kvArray = entry.split("=");
89+
clientInfoMap.put(kvArray[0], (kvArray.length == 2) ? kvArray[1] : "");
10990
}
91+
return clientInfoMap;
92+
}
93+
94+
@Override
95+
public String toString() {
96+
return "AccessControlLogEntry{" + "count=" + count + ", reason='" + reason + '\''
97+
+ ", context='" + context + '\'' + ", object='" + object + '\'' + ", username='" + username
98+
+ '\'' + ", ageSeconds='" + ageSeconds + '\'' + ", clientInfo=" + clientInfo + '}';
99+
}
110100
}

0 commit comments

Comments
 (0)