001/* 002 * Copyright 2012-2017 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.boot.configurationmetadata; 018 019import java.io.Serializable; 020 021/** 022 * Indicate that a property is deprecated. Provide additional information about the 023 * deprecation. 024 * 025 * @author Stephane Nicoll 026 * @since 1.3.0 027 */ 028@SuppressWarnings("serial") 029public class Deprecation implements Serializable { 030 031 private Level level = Level.WARNING; 032 033 private String reason; 034 035 private String replacement; 036 037 /** 038 * Define the {@link Level} of deprecation. 039 * @return the deprecation level 040 */ 041 public Level getLevel() { 042 return this.level; 043 } 044 045 public void setLevel(Level level) { 046 this.level = level; 047 } 048 049 /** 050 * A reason why the related property is deprecated, if any. Can be multi-lines. 051 * @return the deprecation reason 052 */ 053 public String getReason() { 054 return this.reason; 055 } 056 057 public void setReason(String reason) { 058 this.reason = reason; 059 } 060 061 /** 062 * The full name of the property that replaces the related deprecated property, if 063 * any. 064 * @return the replacement property name 065 */ 066 public String getReplacement() { 067 return this.replacement; 068 } 069 070 public void setReplacement(String replacement) { 071 this.replacement = replacement; 072 } 073 074 @Override 075 public String toString() { 076 return "Deprecation{" + "level='" + this.level + '\'' + ", reason='" + this.reason 077 + '\'' + ", replacement='" + this.replacement + '\'' + '}'; 078 } 079 080 /** 081 * Define the deprecation level. 082 */ 083 public enum Level { 084 085 /** 086 * The property is still bound. 087 */ 088 WARNING, 089 090 /** 091 * The property has been removed and is no longer bound. 092 */ 093 ERROR 094 095 } 096 097}