001/* 002 * Copyright 2012-2018 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 shortReason; 036 037 private String replacement; 038 039 /** 040 * Define the {@link Level} of deprecation. 041 * @return the deprecation level 042 */ 043 public Level getLevel() { 044 return this.level; 045 } 046 047 public void setLevel(Level level) { 048 this.level = level; 049 } 050 051 /** 052 * A reason why the related property is deprecated, if any. Can be multi-lines. 053 * @return the deprecation reason 054 * @see #getShortReason() 055 */ 056 public String getReason() { 057 return this.reason; 058 } 059 060 public void setReason(String reason) { 061 this.reason = reason; 062 } 063 064 /** 065 * A single-line, single-sentence reason why the related property is deprecated, if 066 * any. 067 * @return the short deprecation reason 068 * @see #getReason() 069 */ 070 public String getShortReason() { 071 return this.shortReason; 072 } 073 074 public void setShortReason(String shortReason) { 075 this.shortReason = shortReason; 076 } 077 078 /** 079 * The full name of the property that replaces the related deprecated property, if 080 * any. 081 * @return the replacement property name 082 */ 083 public String getReplacement() { 084 return this.replacement; 085 } 086 087 public void setReplacement(String replacement) { 088 this.replacement = replacement; 089 } 090 091 @Override 092 public String toString() { 093 return "Deprecation{" + "level='" + this.level + '\'' + ", reason='" + this.reason 094 + '\'' + ", replacement='" + this.replacement + '\'' + '}'; 095 } 096 097 /** 098 * Define the deprecation level. 099 */ 100 public enum Level { 101 102 /** 103 * The property is still bound. 104 */ 105 WARNING, 106 107 /** 108 * The property has been removed and is no longer bound. 109 */ 110 ERROR 111 112 } 113 114}