From 601a09fd07960d3aadcf972ba7c72dcea9976aef Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 21 May 2021 12:19:44 -0400 Subject: Enhance toString methods in factory classes The factory classes in policy-endpoints have toString() methods that return "[]" for their list contents. Updated the code to provide a list of the keys rather than just an empty list. Also replaced some toString() methods with lombok. Also replace StringBuilder with concatenation in some cases. Issue-ID: POLICY-3298 Change-Id: I64fca21a4b009f7e09fcc482b5d156753fb7e680 Signed-off-by: Jim Hahn --- .../parameters/ParameterValidationResult.java | 24 ++++++++-------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'common-parameters/src/main/java/org') diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterValidationResult.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterValidationResult.java index b68c62e2..7e56230d 100644 --- a/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterValidationResult.java +++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterValidationResult.java @@ -157,21 +157,13 @@ public class ParameterValidationResult implements ValidationResult { return null; } - var validationResultBuilder = new StringBuilder(); - - validationResultBuilder.append(initialIndentation); - validationResultBuilder.append("field \""); - validationResultBuilder.append(getName()); - validationResultBuilder.append("\" type \""); - validationResultBuilder.append(field.getType().getName()); - validationResultBuilder.append("\" value \""); - validationResultBuilder.append(parameterValue); - validationResultBuilder.append("\" "); - validationResultBuilder.append(getStatus()); - validationResultBuilder.append(", "); - validationResultBuilder.append(message); - validationResultBuilder.append('\n'); - - return validationResultBuilder.toString(); + return initialIndentation + + "field \"" + getName() + + "\" type \"" + field.getType().getName() + + "\" value \"" + parameterValue + + "\" " + getStatus() + + ", " + + message + + '\n'; } } -- cgit 1.2.3-korg