Polish
This commit is contained in:
@@ -160,7 +160,7 @@ public class ConfigurationMetadataProperty {
|
||||
* @see #isDeprecated()
|
||||
*/
|
||||
public Deprecation getDeprecation() {
|
||||
return deprecation;
|
||||
return this.deprecation;
|
||||
}
|
||||
|
||||
public void setDeprecation(Deprecation deprecation) {
|
||||
|
||||
@@ -34,7 +34,7 @@ public class Deprecation {
|
||||
* @return the deprecation reason
|
||||
*/
|
||||
public String getReason() {
|
||||
return reason;
|
||||
return this.reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
@@ -42,11 +42,12 @@ public class Deprecation {
|
||||
}
|
||||
|
||||
/**
|
||||
* The full name of the property that replaces the related deprecated property, if any.
|
||||
* The full name of the property that replaces the related deprecated property, if
|
||||
* any.
|
||||
* @return the replacement property name
|
||||
*/
|
||||
public String getReplacement() {
|
||||
return replacement;
|
||||
return this.replacement;
|
||||
}
|
||||
|
||||
public void setReplacement(String replacement) {
|
||||
@@ -55,7 +56,8 @@ public class Deprecation {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Deprecation{" + "reason='" + reason + '\'' + ", replacement='" + replacement + '\'' + '}';
|
||||
return "Deprecation{" + "reason='" + this.reason + '\'' + ", replacement='"
|
||||
+ this.replacement + '\'' + '}';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -157,7 +157,8 @@ class JsonReader {
|
||||
JSONObject deprecationJsonObject = object.getJSONObject("deprecation");
|
||||
Deprecation deprecation = new Deprecation();
|
||||
deprecation.setReason(deprecationJsonObject.optString("reason", null));
|
||||
deprecation.setReplacement(deprecationJsonObject.optString("replacement", null));
|
||||
deprecation.setReplacement(deprecationJsonObject.optString("replacement",
|
||||
null));
|
||||
return deprecation;
|
||||
}
|
||||
return (object.optBoolean("deprecated") ? new Deprecation() : null);
|
||||
|
||||
@@ -141,17 +141,20 @@ public class JsonReaderTests extends AbstractConfigurationMetadataTests {
|
||||
ConfigurationMetadataItem item = items.get(0);
|
||||
assertProperty(item, "server.port", "server.port", Integer.class, null);
|
||||
assertTrue(item.isDeprecated());
|
||||
assertEquals("Server namespace has moved to spring.server", item.getDeprecation().getReason());
|
||||
assertEquals("Server namespace has moved to spring.server", item.getDeprecation()
|
||||
.getReason());
|
||||
assertEquals("server.spring.port", item.getDeprecation().getReplacement());
|
||||
|
||||
ConfigurationMetadataItem item2 = items.get(1);
|
||||
assertProperty(item2, "server.cluster-name", "server.cluster-name", String.class, null);
|
||||
assertProperty(item2, "server.cluster-name", "server.cluster-name", String.class,
|
||||
null);
|
||||
assertTrue(item2.isDeprecated());
|
||||
assertEquals(null, item2.getDeprecation().getReason());
|
||||
assertEquals(null, item2.getDeprecation().getReplacement());
|
||||
|
||||
ConfigurationMetadataItem item3 = items.get(2);
|
||||
assertProperty(item3, "spring.server.name", "spring.server.name", String.class, null);
|
||||
assertProperty(item3, "spring.server.name", "spring.server.name", String.class,
|
||||
null);
|
||||
assertFalse(item3.isDeprecated());
|
||||
assertEquals(null, item3.getDeprecation());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user