From 3dba7f2f6ee9ad3720a5455bf3c0bcdf61386958 Mon Sep 17 00:00:00 2001 From: jhh Date: Wed, 26 Jan 2022 15:25:11 -0600 Subject: restore manual toString coder methods The changes to use the generic lombok ToString caused excessive verbosity when the coder objects are logged, hence restoring the older manual toString() methods back. Issue-ID: POLICY-3895 Signed-off-by: jhh Change-Id: Idd875172cbb066d13294aeb31fb85577dad127c1 Signed-off-by: jhh --- .../drools/protocol/coders/GsonProtocolCoderToolset.java | 15 +++++++-------- .../drools/protocol/coders/ProtocolCoderToolset.java | 14 ++++++++++---- 2 files changed, 17 insertions(+), 12 deletions(-) (limited to 'policy-management/src') diff --git a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/GsonProtocolCoderToolset.java b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/GsonProtocolCoderToolset.java index f3525e90..80844612 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/GsonProtocolCoderToolset.java +++ b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/GsonProtocolCoderToolset.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2022 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,6 @@ import java.lang.reflect.Type; import java.time.Instant; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; -import lombok.ToString; import org.onap.policy.common.gson.annotation.GsonJsonIgnore; import org.onap.policy.drools.controller.DroolsControllerConstants; import org.onap.policy.drools.protocol.coders.EventProtocolCoder.CoderFilters; @@ -42,7 +41,6 @@ import org.slf4j.LoggerFactory; /** * Tools used for encoding/decoding using GSON. */ -@ToString(callSuper = true) class GsonProtocolCoderToolset extends ProtocolCoderToolset { private static final String CANNOT_FETCH_CLASS = "{}: cannot fetch application class {}"; private static final String FETCH_CLASS_EX_MSG = "cannot fetch application class "; @@ -58,9 +56,6 @@ class GsonProtocolCoderToolset extends ProtocolCoderToolset { @GsonJsonIgnore public static final DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSxxx"); - @GsonJsonIgnore - public static final DateTimeFormatter zuluFormat = DateTimeFormatter.ISO_INSTANT; - /** * Adapter for ZonedDateTime. */ @@ -97,7 +92,6 @@ class GsonProtocolCoderToolset extends ProtocolCoderToolset { } - /** * decoder. */ @@ -197,7 +191,7 @@ class GsonProtocolCoderToolset extends ProtocolCoderToolset { } catch (final Exception e) { logger.warn("{} cannot decode {} into {}", this, json, decoderClass.getName()); throw new UnsupportedOperationException( - "cannont decode into " + decoderFilter.getFactClass(), e); + "cannot decode into " + decoderFilter.getFactClass(), e); } } } @@ -232,4 +226,9 @@ class GsonProtocolCoderToolset extends ProtocolCoderToolset { } } } + + @Override + public String toString() { + return "GsonProtocolCoderToolset [toString()=" + super.toString() + "]"; + } } diff --git a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java index 493095b7..277c4ed3 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java +++ b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2022 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,7 +26,6 @@ import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import lombok.Getter; import lombok.Setter; -import lombok.ToString; import org.onap.policy.drools.protocol.coders.EventProtocolCoder.CoderFilters; import org.onap.policy.drools.protocol.coders.TopicCoderFilterConfiguration.CustomCoder; import org.slf4j.Logger; @@ -36,13 +35,12 @@ import org.slf4j.LoggerFactory; * Protocol Coding/Decoding Toolset. */ @Getter -@ToString public abstract class ProtocolCoderToolset { /** * Logger. */ - private static Logger logger = LoggerFactory.getLogger(ProtocolCoderToolset.class); + private static final Logger logger = LoggerFactory.getLogger(ProtocolCoderToolset.class); /** * topic. @@ -226,4 +224,12 @@ public abstract class ProtocolCoderToolset { * @throws UnsupportedOperationException if parsing into POJO is not possible */ public abstract String encode(Object event); + + @Override + public String toString() { + return "ProtocolCoderToolset [topic=" + this.topic + ", controllerId=" + + this.controllerId + ", groupId=" + groupId + ", artifactId=" + + this.artifactId + ", coders=" + this.coders + + ", customCoder=" + this.customCoder + "]"; + } } -- cgit 1.2.3-korg