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; 020import java.util.HashMap; 021import java.util.Map; 022 023/** 024 * A source of configuration metadata. Also defines where the source is declared, for 025 * instance if it is defined as a {@code @Bean}. 026 * 027 * @author Stephane Nicoll 028 * @since 1.3.0 029 */ 030@SuppressWarnings("serial") 031public class ConfigurationMetadataSource implements Serializable { 032 033 private String groupId; 034 035 private String type; 036 037 private String description; 038 039 private String shortDescription; 040 041 private String sourceType; 042 043 private String sourceMethod; 044 045 private final Map<String, ConfigurationMetadataProperty> properties = new HashMap<>(); 046 047 /** 048 * The identifier of the group to which this source is associated. 049 * @return the group id 050 */ 051 public String getGroupId() { 052 return this.groupId; 053 } 054 055 void setGroupId(String groupId) { 056 this.groupId = groupId; 057 } 058 059 /** 060 * The type of the source. Usually this is the fully qualified name of a class that 061 * defines configuration items. This class may or may not be available at runtime. 062 * @return the type 063 */ 064 public String getType() { 065 return this.type; 066 } 067 068 void setType(String type) { 069 this.type = type; 070 } 071 072 /** 073 * A description of this source, if any. Can be multi-lines. 074 * @return the description 075 * @see #getShortDescription() 076 */ 077 public String getDescription() { 078 return this.description; 079 } 080 081 void setDescription(String description) { 082 this.description = description; 083 } 084 085 /** 086 * A single-line, single-sentence description of this source, if any. 087 * @return the short description 088 * @see #getDescription() 089 */ 090 public String getShortDescription() { 091 return this.shortDescription; 092 } 093 094 public void setShortDescription(String shortDescription) { 095 this.shortDescription = shortDescription; 096 } 097 098 /** 099 * The type where this source is defined. This can be identical to the 100 * {@link #getType() type} if the source is self-defined. 101 * @return the source type 102 */ 103 public String getSourceType() { 104 return this.sourceType; 105 } 106 107 void setSourceType(String sourceType) { 108 this.sourceType = sourceType; 109 } 110 111 /** 112 * The method name that defines this source, if any. 113 * @return the source method 114 */ 115 public String getSourceMethod() { 116 return this.sourceMethod; 117 } 118 119 void setSourceMethod(String sourceMethod) { 120 this.sourceMethod = sourceMethod; 121 } 122 123 /** 124 * Return the properties defined by this source. 125 * @return the properties 126 */ 127 public Map<String, ConfigurationMetadataProperty> getProperties() { 128 return this.properties; 129 } 130 131}