/*
 * Copyright © 2015-2017 Santer Reply S.p.A.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package it.reply.orchestrator.dto;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;

import lombok.AccessLevel;
import lombok.Data;
import lombok.Getter;
import lombok.ToString;

import org.checkerframework.checker.nullness.qual.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;

@Data
@ToString(exclude = "log")
public abstract class AdditionalPropertiesAwareDto {

  @Getter(AccessLevel.NONE)
  private final Logger log = LoggerFactory.getLogger(getClass());

  @JsonIgnore
  @NonNull
  @Getter(onMethod_ = { @JsonAnyGetter })
  private HashMap<String, Object> additionalProperties = new HashMap<>();

  @JsonAnySetter
  public void setAdditionalProperty(String name, Object value) {
    log.trace("Putting unknown property <{}> with value: {} in additionalProperties", name, value);
    this.additionalProperties.put(name, value);
  }
}

@@ -850,16 +850,49 @@
 k.Data;%0A
+import lombok.EqualsAndHashCode;%0A
 import l
@@ -1107,16 +1107,52 @@
  %22log%22)%0A
+@EqualsAndHashCode(exclude = %22log%22)%0A
 public a

Exclude logger from equal and hash code evaluation