Refactor rename method ProfileLocation.shortDescription() to location() (#1859)

This commit is contained in:
Rob Bygrave
2019-11-20 20:01:45 +13:00
committed by GitHub
parent ca71fef74a
commit 88839f7613
9 changed files with 27 additions and 27 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ public interface ProfileLocation {
/**
* Return a short version of the location description.
*/
String shortDescription();
String location();
/**
* Return the short label.
@@ -7,19 +7,19 @@ import io.ebean.ProfileLocation;
*/
final class BasicProfileLocation implements ProfileLocation {
private final String fullLocation;
private final String location;
private final String shortDescription;
private final String label;
BasicProfileLocation(String location) {
this.location = location;
this.shortDescription = shortDesc(location);
this.label = UtilLocation.label(shortDescription);
BasicProfileLocation(String fullLocation) {
this.fullLocation = fullLocation;
this.location = shortDesc(fullLocation);
this.label = UtilLocation.label(location);
}
@Override
public String toString() {
return shortDescription;
return location;
}
@Override
@@ -29,7 +29,7 @@ final class BasicProfileLocation implements ProfileLocation {
@Override
public String obtain() {
return location;
return fullLocation;
}
@Override
@@ -38,8 +38,8 @@ final class BasicProfileLocation implements ProfileLocation {
}
@Override
public String shortDescription() {
return shortDescription;
public String location() {
return location;
}
private String shortDesc(String location) {
@@ -11,9 +11,9 @@ class DProfileLocation implements ProfileLocation {
private static final String UNKNOWN = "unknown";
private String location;
private String fullLocation;
private String shortDescription;
private String location;
private String label;
@@ -43,15 +43,15 @@ class DProfileLocation implements ProfileLocation {
@Override
public String obtain() {
// atomic assignments so happy enough with this (racing but atomic)
if (location == null) {
if (fullLocation == null) {
final String loc = create();
final String shortDesc = shortDesc(loc);
label = UtilLocation.label(shortDesc);
shortDescription = shortDesc;
location = loc;
location = shortDesc;
fullLocation = loc;
initWith(label);
}
return location;
return fullLocation;
}
protected void initWith(String label) {
@@ -64,8 +64,8 @@ class DProfileLocation implements ProfileLocation {
}
@Override
public String shortDescription() {
return shortDescription;
public String location() {
return location;
}
private String create() {
@@ -39,7 +39,7 @@ class DQueryPlanMeta {
}
public String getLocation() {
return (profileLocation == null) ? null : profileLocation.shortDescription();
return (profileLocation == null) ? null : profileLocation.location();
}
public String getSql() {
@@ -53,7 +53,7 @@ class DTimedProfileLocation extends DProfileLocation implements TimedProfileLoca
if (overrideMetricName) {
collect.setName(fullName);
}
collect.setLocation(shortDescription());
collect.setLocation(location());
visitor.visitTimed(collect);
}
}
@@ -176,7 +176,7 @@ public class CQueryPlan {
}
private String location() {
return (profileLocation == null) ? null : profileLocation.shortDescription();
return (profileLocation == null) ? null : profileLocation.location();
}
private CQueryPlanKey buildPlanKey(String sql, boolean rowNumberIncluded, String logWhereSql) {