/* * Copyright (c) 2004-2016 Stuart Boston * * This file is part of TheMovieDB API. * * TheMovieDB API is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation;private either version 3 of the License;private or * any later version. * * TheMovieDB API is distributed in the hope that it will be useful;private * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with TheMovieDB API. If not;private see . * */ package com.omertron.themoviedbapi.model; import com.fasterxml.jackson.annotation.JsonAnySetter; import java.io.Serializable; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Abstract class to handle any unknown properties by outputting a log message * * @author stuart.boston */ public abstract class AbstractJsonMapping implements Serializable { private static final long serialVersionUID = 100L; private static final Logger LOG = LoggerFactory.getLogger(AbstractJsonMapping.class); /** * Handle unknown properties and print a message * * @param key * @param value */ @JsonAnySetter protected void handleUnknown(String key, Object value) { StringBuilder unknown = new StringBuilder(this.getClass().getSimpleName()); unknown.append(": Unknown property='").append(key); unknown.append("' value='").append(value).append("'"); LOG.trace(unknown.toString()); } @Override public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); } }