Skip to content

Commit 9dd8964

Browse files
committed
Rename this method
1 parent 4505286 commit 9dd8964

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/MaxmindIpDataLookups.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static class AnonymousIp extends AbstractBase<AnonymousIpResponse, AnonymousIpRe
119119
}
120120

121121
@Override
122-
protected AnonymousIpResponse record(AnonymousIpResponse response) {
122+
protected AnonymousIpResponse cacheableRecord(AnonymousIpResponse response) {
123123
return response;
124124
}
125125

@@ -166,7 +166,7 @@ static class Asn extends AbstractBase<AsnResponse, AsnResponse> {
166166
}
167167

168168
@Override
169-
protected AsnResponse record(AsnResponse response) {
169+
protected AsnResponse cacheableRecord(AsnResponse response) {
170170
return response;
171171
}
172172

@@ -207,7 +207,7 @@ static class City extends AbstractBase<CityResponse, CityResponse> {
207207
}
208208

209209
@Override
210-
protected CityResponse record(CityResponse response) {
210+
protected CityResponse cacheableRecord(CityResponse response) {
211211
return response;
212212
}
213213

@@ -332,7 +332,7 @@ static class ConnectionType extends AbstractBase<ConnectionTypeResponse, Connect
332332
}
333333

334334
@Override
335-
protected ConnectionTypeResponse record(ConnectionTypeResponse response) {
335+
protected ConnectionTypeResponse cacheableRecord(ConnectionTypeResponse response) {
336336
return response;
337337
}
338338

@@ -372,7 +372,7 @@ static class Country extends AbstractBase<CountryResponse, Result<CacheableCount
372372
}
373373

374374
@Override
375-
protected Result<CacheableCountryResponse> record(CountryResponse response) {
375+
protected Result<CacheableCountryResponse> cacheableRecord(CountryResponse response) {
376376
final com.maxmind.geoip2.record.Country country = response.getCountry();
377377
final Continent continent = response.getContinent();
378378
final com.maxmind.geoip2.record.Country registeredCountry = response.getRegisteredCountry();
@@ -457,7 +457,7 @@ static class Domain extends AbstractBase<DomainResponse, DomainResponse> {
457457
}
458458

459459
@Override
460-
protected DomainResponse record(DomainResponse response) {
460+
protected DomainResponse cacheableRecord(DomainResponse response) {
461461
return response;
462462
}
463463

@@ -486,7 +486,7 @@ static class Enterprise extends AbstractBase<EnterpriseResponse, EnterpriseRespo
486486
}
487487

488488
@Override
489-
protected EnterpriseResponse record(EnterpriseResponse response) {
489+
protected EnterpriseResponse cacheableRecord(EnterpriseResponse response) {
490490
return response;
491491
}
492492

@@ -714,7 +714,7 @@ static class Isp extends AbstractBase<IspResponse, IspResponse> {
714714
}
715715

716716
@Override
717-
protected IspResponse record(IspResponse response) {
717+
protected IspResponse cacheableRecord(IspResponse response) {
718718
return response;
719719
}
720720

@@ -820,14 +820,16 @@ private RECORD lookup(final Reader reader, final String ipAddress) throws IOExce
820820
final InetAddress ip = InetAddresses.forString(ipAddress);
821821
final DatabaseRecord<RESPONSE> entry = reader.getRecord(ip, clazz);
822822
final RESPONSE data = entry.getData();
823-
return (data == null) ? null : record(builder.build(data, NetworkAddress.format(ip), entry.getNetwork(), List.of("en")));
823+
return (data == null)
824+
? null
825+
: cacheableRecord(builder.build(data, NetworkAddress.format(ip), entry.getNetwork(), List.of("en")));
824826
}
825827

826828
/**
827829
* Given a fully-populated response object, create a record that is suitable for caching. If the fully-populated response object
828830
* itself is suitable for caching, then it is acceptable to simply return it.
829831
*/
830-
protected abstract RECORD record(RESPONSE response);
832+
protected abstract RECORD cacheableRecord(RESPONSE response);
831833

832834
/**
833835
* Extract the configured properties from the retrieved response.

modules/ingest-geoip/src/test/java/org/elasticsearch/ingest/geoip/MaxMindSupportTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ private static Set<Class<? extends AbstractResponse>> getUsedMaxMindResponseClas
645645
Method[] declaredMethods = declaredClass.getDeclaredMethods();
646646
Optional<Method> nonAbstractTransformMethod = Arrays.stream(declaredMethods)
647647
.filter(
648-
method -> method.getName().equals("record")
648+
method -> method.getName().equals("cacheableRecord")
649649
&& method.getParameterTypes().length == 1
650650
&& Modifier.isAbstract(method.getParameterTypes()[0].getModifiers()) == false
651651
)

0 commit comments

Comments
 (0)