Skip to content

Commit ba6b4e4

Browse files
Add missing Javadoc
1 parent 89b42e6 commit ba6b4e4

3 files changed

Lines changed: 42 additions & 3 deletions

File tree

src/main/java/co/ipregistry/api/client/IpregistryClient.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,16 @@ public IpInfoList lookup(final List<String> ips, final IpregistryOption... optio
206206
return new IpInfoList(result);
207207
}
208208

209+
/**
210+
* Parse the given {@code userAgents} values.
211+
*
212+
* @param userAgents the raw user-agent values.
213+
* A typical raw user-agent value is the value you retrieve for the user-agent header
214+
* from an incoming HTTP request.
215+
* @return parsed data associated with incoming {@code userAgents}.
216+
* @throws ApiException if an API issue happens.
217+
* @throws ClientException if a client issue happens.
218+
*/
209219
public UserAgentList parse(final String... userAgents) throws ApiException, ClientException {
210220
return requestHandler.parse(userAgents);
211221
}

src/main/java/co/ipregistry/api/client/model/UserAgentList.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package co.ipregistry.api.client.model;
1818

19+
import co.ipregistry.api.client.exceptions.IpInfoException;
1920
import co.ipregistry.api.client.exceptions.UserAgentException;
2021
import com.fasterxml.jackson.annotation.JsonProperty;
2122
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@@ -57,6 +58,16 @@ public void set(final int index, final Object value) {
5758
userAgents[index] = value;
5859
}
5960

61+
/**
62+
* Returns data for the user-agent at the specified {@code index}.
63+
* If an exception was thrown while handling the associated request, this exception is rethrown when invoking this method.
64+
* <p>
65+
* The order is the one of the requests that have been inputted for dispatching.
66+
*
67+
* @param index the index of the list.
68+
* @return UserAgent data at the specified index.
69+
* @throws UserAgentException if an exception was thrown while handling the associated request.
70+
*/
6071
public UserAgent get(final int index) throws UserAgentException {
6172
final Object object = userAgents[index];
6273

@@ -80,6 +91,15 @@ public int size() {
8091
return userAgents.length;
8192
}
8293

94+
/**
95+
* Returns data for the user-agent at the specified {@code index}.
96+
* If an exception was thrown while handling the associated request, the return value is an exception. Otherwise, this is the IpInfo data.
97+
* <p>
98+
* The order is the one of the requests that have been inputted for dispatching.
99+
*
100+
* @param index the index of the list.
101+
* @return UserAgent data at the specified index, or the exception thrown while dispatching the associated request.
102+
*/
83103
public Object unsafeGet(final int index) {
84104
return userAgents[index];
85105
}

src/main/java/co/ipregistry/api/client/request/IpregistryRequestHandler.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package co.ipregistry.api.client.request;
1818

19-
import co.ipregistry.api.client.exceptions.ApiException;
20-
import co.ipregistry.api.client.exceptions.ClientException;
2119
import co.ipregistry.api.client.exceptions.IpregistryException;
2220
import co.ipregistry.api.client.model.IpInfo;
2321
import co.ipregistry.api.client.model.IpInfoList;
@@ -58,6 +56,17 @@ public interface IpregistryRequestHandler {
5856
*/
5957
IpInfoList lookup(Iterable<String> ips, IpregistryOption... options) throws IpregistryException;
6058

61-
UserAgentList parse(String... userAgents) throws ApiException, ClientException;
59+
/**
60+
* Parse the given {@code userAgents} values.
61+
*
62+
* @param userAgents the raw user-agent values.
63+
* A typical raw user-agent value is the value you retrieve for the user-agent header
64+
* from an incoming HTTP request.
65+
* @return parsed data associated with incoming {@code userAgents}.
66+
* @throws IpregistryException if an error happens when looking up data.
67+
* It can be an {@link co.ipregistry.api.client.exceptions.ApiException}
68+
* or a {@link co.ipregistry.api.client.exceptions.ClientException}.
69+
*/
70+
UserAgentList parse(String... userAgents) throws IpregistryException;
6271

6372
}

0 commit comments

Comments
 (0)