Polish Javadoc

This commit is contained in:
Phillip Webb
2015-09-06 00:28:00 -07:00
parent e07df7e4c6
commit e674d751de
252 changed files with 680 additions and 348 deletions

View File

@@ -61,7 +61,7 @@ public class AuditEvent implements Serializable {
/**
* Create a new audit event for the current time from data provided as name-value
* pairs
* pairs.
* @param principal The user principal responsible
* @param type the event type
* @param data The event data in the form 'key=value' or simply 'key'

View File

@@ -46,7 +46,8 @@ public class InMemoryAuditEventRepository implements AuditEventRepository {
}
/**
* @param capacity the capacity to set
* Set the capacity of this event repository.
* @param capacity the capacity
*/
public synchronized void setCapacity(int capacity) {
this.events = new AuditEvent[capacity];

View File

@@ -82,6 +82,7 @@ public class AuditApplicationEvent extends ApplicationEvent {
}
/**
* Get the audit event.
* @return the audit event
*/
public AuditEvent getAuditEvent() {

View File

@@ -21,7 +21,7 @@ import java.util.List;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Configuration properties for some health properties
* Configuration properties for some health properties.
*
* @author Christian Dupuis
* @since 1.2.0

View File

@@ -52,7 +52,7 @@ public class ManagementContextResolver {
}
/**
* Return the management {@link ApplicationContext}
* Return the management {@link ApplicationContext}.
* @return the management {@link ApplicationContext}
*/
public ApplicationContext getApplicationContext() {

View File

@@ -185,7 +185,7 @@ public class ManagementWebSecurityAutoConfiguration {
}
/**
* WebSecurityEnabler condition
* WebSecurityEnabler condition.
*/
static class WebSecurityEnablerCondition extends SpringBootCondition {

View File

@@ -221,7 +221,7 @@ public class ShellProperties {
}
/**
* SSH properties
* SSH properties.
*/
public static class Ssh extends CrshShellProperties {
@@ -279,7 +279,7 @@ public class ShellProperties {
}
/**
* Telnet properties
* Telnet properties.
*/
public static class Telnet extends CrshShellProperties {
@@ -322,7 +322,7 @@ public class ShellProperties {
}
/**
* Auth specific properties for JAAS authentication
* Auth specific properties for JAAS authentication.
*/
@ConfigurationProperties(prefix = "shell.auth.jaas", ignoreUnknownFields = false)
public static class JaasAuthenticationProperties extends
@@ -351,7 +351,7 @@ public class ShellProperties {
}
/**
* Auth specific properties for key authentication
* Auth specific properties for key authentication.
*/
@ConfigurationProperties(prefix = "shell.auth.key", ignoreUnknownFields = false)
public static class KeyAuthenticationProperties extends
@@ -382,7 +382,7 @@ public class ShellProperties {
}
/**
* Auth specific properties for simple authentication
* Auth specific properties for simple authentication.
*/
@ConfigurationProperties(prefix = "shell.auth.simple", ignoreUnknownFields = false)
public static class SimpleAuthenticationProperties extends
@@ -457,7 +457,7 @@ public class ShellProperties {
}
/**
* Auth specific properties for Spring authentication
* Auth specific properties for Spring authentication.
*/
@ConfigurationProperties(prefix = "shell.auth.spring", ignoreUnknownFields = false)
public static class SpringAuthenticationProperties extends

View File

@@ -37,9 +37,9 @@ import org.springframework.cache.CacheManager;
* Base {@link CacheStatisticsProvider} implementation that uses JMX to retrieve the cache
* statistics.
*
* @param <C> The cache type
* @author Stephane Nicoll
* @since 1.3.0
* @param <C> The cache type
*/
public abstract class AbstractJmxCacheStatisticsProvider<C extends Cache> implements
CacheStatisticsProvider<C> {

View File

@@ -144,6 +144,10 @@ public class ConfigurationPropertiesReportEndpoint extends
/**
* Cautiously serialize the bean to a map (returning a map with an error message
* instead of throwing an exception if there is a problem).
* @param mapper the object mapper
* @param bean the source bean
* @param prefix the prefix
* @return the serialized instance
*/
private Map<String, Object> safeSerialize(ObjectMapper mapper, Object bean,
String prefix) {
@@ -173,6 +177,7 @@ public class ConfigurationPropertiesReportEndpoint extends
/**
* Ensure only bindable and non-cyclic bean properties are reported.
* @param mapper the object mapper
*/
private void applySerializationModifier(ObjectMapper mapper) {
SerializerFactory factory = BeanSerializerFactory.instance
@@ -183,6 +188,7 @@ public class ConfigurationPropertiesReportEndpoint extends
/**
* Configure PropertyFilter to make sure Jackson doesn't process CGLIB generated bean
* properties.
* @param mapper the object mapper
*/
private void applyCglibFilters(ObjectMapper mapper) {
mapper.setAnnotationIntrospector(new CglibAnnotationIntrospector());
@@ -192,7 +198,11 @@ public class ConfigurationPropertiesReportEndpoint extends
/**
* Extract configuration prefix from {@link ConfigurationProperties} annotation.
* @param beanFactoryMetaData
* @param context the application context
* @param beanFactoryMetaData the bean factory meta-data
* @param beanName the bean name
* @param bean the bean
* @return the prefix
*/
private String extractPrefix(ApplicationContext context,
ConfigurationBeanFactoryMetaData beanFactoryMetaData, String beanName,
@@ -216,6 +226,8 @@ public class ConfigurationPropertiesReportEndpoint extends
/**
* Sanitize all unwanted configuration properties to avoid leaking of sensitive
* information.
* @param map the source map
* @return the sanitized map
*/
@SuppressWarnings("unchecked")
private Map<String, Object> sanitize(Map<String, Object> map) {

View File

@@ -113,6 +113,7 @@ public class DataSourcePublicMetrics implements PublicMetrics {
* Attempt to locate the primary {@link DataSource} (i.e. either the only data source
* available or the one amongst the candidates marked as {@link Primary}. Return
* {@code null} if there no primary data source could be found.
* @return the primary datasource
*/
private DataSource getPrimaryDataSource() {
try {

View File

@@ -55,6 +55,9 @@ public class FlywayEndpoint extends AbstractEndpoint<List<FlywayMigration>> {
return migrations;
}
/**
* Migration properties.
*/
public static class FlywayMigration {
private MigrationType type;

View File

@@ -83,6 +83,8 @@ public class HealthEndpoint extends AbstractEndpoint<Health> {
/**
* Turns the bean name into a key that can be used in the map of health information.
* @param name the bean name
* @return the key
*/
private String getKey(String name) {
int index = name.toLowerCase().indexOf("healthindicator");

View File

@@ -29,7 +29,8 @@ import org.springframework.boot.actuate.metrics.Metric;
public interface PublicMetrics {
/**
* @return an indication of current state through metrics
* Return an indication of current state through metrics.
* @return the public metrics
*/
Collection<Metric<?>> metrics();

View File

@@ -58,14 +58,16 @@ public class RequestMappingEndpoint extends AbstractEndpoint<Map<String, Object>
}
/**
* @param handlerMappings the mappings to set
* Set the handler mappings.
* @param handlerMappings the handler mappings
*/
public void setHandlerMappings(List<AbstractUrlHandlerMapping> handlerMappings) {
this.handlerMappings = handlerMappings;
}
/**
* @param methodMappings the method mappings to set
* Set the method mappings.
* @param methodMappings the method mappings
*/
public void setMethodMappings(List<AbstractHandlerMethodMapping<?>> methodMappings) {
this.methodMappings = methodMappings;

View File

@@ -76,6 +76,7 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered {
/**
* Add metrics from ManagementFactory if possible. Note that ManagementFactory is not
* available on Google App Engine.
* @param result the result
*/
private void addManagementMetrics(Collection<Metric<?>> result) {
try {
@@ -153,6 +154,8 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered {
/**
* Turn GC names like 'PS Scavenge' or 'PS MarkSweep' into something that is more
* metrics friendly.
* @param name the source name
* @return a metric friendly name
*/
private String beautifyGcName(String name) {
return StringUtils.replace(name, " ", "_").toLowerCase();

View File

@@ -61,6 +61,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecycle,
ApplicationContextAware {
/**
* The default JMX domain.
*/
public static final String DEFAULT_DOMAIN = "org.springframework.boot";
private static Log logger = LogFactory.getLog(EndpointMBeanExporter.class);

View File

@@ -32,6 +32,14 @@ import org.springframework.web.servlet.resource.ResourceTransformer;
import org.springframework.web.servlet.resource.ResourceTransformerChain;
import org.springframework.web.servlet.resource.TransformedResource;
/**
* {@link MvcEndpoint} to expose a HAL browser.
*
* @author Dave Syer
* @author Phillip Webb
* @author Andy Wilkinson
* @since 1.3.0
*/
public class ActuatorHalBrowserEndpoint extends ActuatorHalJsonEndpoint implements
ResourceLoaderAware {
@@ -93,6 +101,9 @@ public class ActuatorHalBrowserEndpoint extends ActuatorHalJsonEndpoint implemen
return null;
}
/**
* HAL Browser properties.
*/
public static class HalBrowserLocation {
private final String resourceLocation;

View File

@@ -29,12 +29,12 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
* {@link MvcEndpoint} for the actuator. Uses content negotiation to provide access to the
* HAL browser (when on the classpath), and to HAL-formatted JSON.
* {@link MvcEndpoint} to expose HAL-formatted JSON.
*
* @author Dave Syer
* @author Phil Webb
* @author Phillip Webb
* @author Andy Wilkinson
* @since 1.3.0
*/
@ConfigurationProperties("endpoints.actuator")
public class ActuatorHalJsonEndpoint extends WebMvcConfigurerAdapter implements

View File

@@ -97,7 +97,7 @@ public class EndpointHandlerMapping extends RequestMappingHandlerMapping {
/**
* Since all handler beans are passed into the constructor there is no need to detect
* anything here
* anything here.
*/
@Override
protected boolean isHandler(Class<?> beanType) {
@@ -149,7 +149,8 @@ public class EndpointHandlerMapping extends RequestMappingHandlerMapping {
}
/**
* @param prefix the prefix to set
* Set the prefix used in mappings.
* @param prefix the prefix
*/
public void setPrefix(String prefix) {
Assert.isTrue("".equals(prefix) || StringUtils.startsWithIgnoreCase(prefix, "/"),
@@ -158,13 +159,15 @@ public class EndpointHandlerMapping extends RequestMappingHandlerMapping {
}
/**
* @return the prefix used in mappings
* Get the prefix used in mappings.
* @return the prefix
*/
public String getPrefix() {
return this.prefix;
}
/**
* Get the path of the endpoint.
* @param endpoint the endpoint
* @return the path used in mappings
*/
@@ -189,7 +192,7 @@ public class EndpointHandlerMapping extends RequestMappingHandlerMapping {
}
/**
* Return the endpoints
* Return the endpoints.
* @return the endpoints
*/
public Set<? extends MvcEndpoint> getEndpoints() {

View File

@@ -25,7 +25,7 @@ package org.springframework.boot.actuate.endpoint.mvc;
public interface EndpointHandlerMappingCustomizer {
/**
* Customize the specified {@link EndpointHandlerMapping}
* Customize the specified {@link EndpointHandlerMapping}.
* @param mapping the {@link EndpointHandlerMapping} to customize
*/
void customize(EndpointHandlerMapping mapping);

View File

@@ -74,10 +74,9 @@ public class EndpointMvcAdapter implements MvcEndpoint {
/**
* Returns the response that should be returned when the endpoint is disabled.
*
* @see Endpoint#isEnabled()
* @since 1.2.4
* @return The response to be returned when the endpoint is disabled
* @since 1.2.4
* @see Endpoint#isEnabled()
*/
protected ResponseEntity<?> getDisabledResponse() {
return MvcEndpoint.DISABLED_RESPONSE;

View File

@@ -34,6 +34,9 @@ import org.springframework.http.ResponseEntity;
*/
public interface MvcEndpoint {
/**
* A {@link ResponseEntity} returned for disabled endpoints.
*/
ResponseEntity<Map<String, String>> DISABLED_RESPONSE = new ResponseEntity<Map<String, String>>(
Collections.singletonMap("message", "This endpoint is disabled"),
HttpStatus.NOT_FOUND);

View File

@@ -26,9 +26,9 @@ import java.util.regex.Pattern;
* must provide implementations of {@link #getValue(Object, String)} and
* {@link #getNames(Object, NameCallback)}.
*
* @param <T> The source data type
* @author Phillip Webb
* @author Sergei Egorov
* @param <T> The source data type
* @since 1.3.0
*/
abstract class NamePatternFilter<T> {
@@ -66,12 +66,18 @@ abstract class NamePatternFilter<T> {
protected abstract Object getValue(T source, String name);
/**
* Callback used to add a name.
*/
protected interface NameCallback {
void addName(String name);
}
/**
* {@link NameCallback} implementation to collect results.
*/
private class ResultCollectingNameCallback implements NameCallback {
private final Pattern pattern;

View File

@@ -185,6 +185,9 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator implement
}
/**
* Known database products.
*/
protected enum Product {
HSQLDB("HSQL Database Engine",

View File

@@ -37,7 +37,7 @@ public class DiskSpaceHealthIndicator extends AbstractHealthIndicator {
private final DiskSpaceHealthIndicatorProperties properties;
/**
* Create a new {@code DiskSpaceHealthIndicator}
* Create a new {@code DiskSpaceHealthIndicator}.
* @param properties the disk space properties
*/
@Autowired

View File

@@ -22,7 +22,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.util.Assert;
/**
* External configuration properties for {@link DiskSpaceHealthIndicator}
* External configuration properties for {@link DiskSpaceHealthIndicator}.
*
* @author Andy Wilkinson
* @since 1.2.0

View File

@@ -22,7 +22,7 @@ import java.util.List;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* External configuration properties for {@link ElasticsearchHealthIndicator}
* External configuration properties for {@link ElasticsearchHealthIndicator}.
*
* @author Binwei Yang
* @author Andy Wilkinson

View File

@@ -68,7 +68,8 @@ public final class Health {
}
/**
* @return the status of the health (never {@code null})
* Return the status of the health.
* @return the status (never {@code null})
*/
@JsonUnwrapped
public Status getStatus() {
@@ -76,7 +77,8 @@ public final class Health {
}
/**
* @return the details of the health or an empty map.
* Return the details of the health.
* @return the details (or an empty map)
*/
@JsonAnyGetter
public Map<String, Object> getDetails() {
@@ -280,7 +282,7 @@ public final class Health {
}
/**
* Set status to given {@link Status} instance
* Set status to given {@link Status} instance.
* @param status the status
* @return this {@link Builder} instance
*/

View File

@@ -25,7 +25,8 @@ package org.springframework.boot.actuate.health;
public interface HealthIndicator {
/**
* @return an indication of health
* Return an indication of health.
* @return the health for
*/
Health health();

View File

@@ -38,22 +38,22 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public final class Status {
/**
* Convenient constant value representing unknown state
* Convenient constant value representing unknown state.
*/
public static final Status UNKNOWN = new Status("UNKNOWN");
/**
* Convenient constant value representing up state
* Convenient constant value representing up state.
*/
public static final Status UP = new Status("UP");
/**
* Convenient constant value representing down state
* Convenient constant value representing down state.
*/
public static final Status DOWN = new Status("DOWN");
/**
* Convenient constant value representing out-of-service state
* Convenient constant value representing out-of-service state.
*/
public static final Status OUT_OF_SERVICE = new Status("OUT_OF_SERVICE");
@@ -82,7 +82,8 @@ public final class Status {
}
/**
* @return the code for this status
* Return the code for this status.
* @return the code
*/
@JsonProperty("status")
public String getCode() {
@@ -90,7 +91,8 @@ public final class Status {
}
/**
* @return the description of this status
* Return the description of this status.
* @return the description
*/
@JsonInclude(Include.NON_EMPTY)
public String getDescription() {

View File

@@ -30,7 +30,7 @@ package org.springframework.boot.actuate.metrics;
public interface GaugeService {
/**
* Set the specified gauge value
* Set the specified gauge value.
* @param metricName the name of the gauge to set
* @param value the value of the gauge
*/

View File

@@ -19,9 +19,9 @@ package org.springframework.boot.actuate.metrics.buffer;
/**
* Base class for a mutable buffer containing a timestamp and a value.
*
* @param <T> The value type
* @author Dave Syer
* @author Phillip Webb
* @param <T> The value type
*/
abstract class Buffer<T extends Number> {

View File

@@ -32,8 +32,7 @@ import com.codahale.metrics.Timer;
/**
* A {@link GaugeService} and {@link CounterService} that sends data to a Dropwizard
* {@link MetricRegistry} based on a naming convention:
*
* {@link MetricRegistry} based on a naming convention.
* <ul>
* <li>Updates to {@link #increment(String)} with names in "meter.*" are treated as
* {@link Meter} events</li>

View File

@@ -109,6 +109,9 @@ public class MetricExportProperties extends TriggerProperties {
return this;
}
/**
* Aggregate properties.
*/
public static class Aggregate {
/**
@@ -147,6 +150,9 @@ public class MetricExportProperties extends TriggerProperties {
}
/**
* Redis properties.
*/
public static class Redis {
/**

View File

@@ -127,6 +127,9 @@ public class JmxMetricWriter implements MetricWriter {
return this.namingStrategy.getObjectName(value, key);
}
/**
* A single metric value.
*/
@ManagedResource
public static class MetricValue {

View File

@@ -38,8 +38,14 @@ import org.springframework.util.ObjectUtils;
*/
public class DefaultOpenTsdbNamingStrategy implements OpenTsdbNamingStrategy {
/**
* The domain key.
*/
public static final String DOMAIN_KEY = "domain";
/**
* The process key.
*/
public static final String PROCESS_KEY = "process";
/**

View File

@@ -25,7 +25,7 @@ package org.springframework.boot.actuate.metrics.opentsdb;
public interface OpenTsdbNamingStrategy {
/**
* Convert the metric name into a {@link OpenTsdbName}
* Convert the metric name into a {@link OpenTsdbName}.
* @param metricName the name of the metric
* @return an Open TSDB name
*/

View File

@@ -28,13 +28,14 @@ import org.springframework.boot.actuate.metrics.writer.PrefixMetricWriter;
public interface MultiMetricRepository extends PrefixMetricReader, PrefixMetricWriter {
/**
* The names of all the groups known to this repository
* The names of all the groups known to this repository.
* @return all available group names
*/
Iterable<String> groups();
/**
* @return the number of groups available
* The number of groups available in this repository.
* @return the number of groups
*/
long countGroups();

View File

@@ -31,16 +31,34 @@ import org.springframework.util.Assert;
*/
public final class RichGauge {
/**
* The suffix for count gauges.
*/
public static final String COUNT = ".count";
/**
* The suffix for max gauges.
*/
public static final String MAX = ".max";
/**
* The suffix for min gauges.
*/
public static final String MIN = ".min";
/**
* The suffix for average value gauges.
*/
public static final String AVG = ".avg";
/**
* The suffix for alpha gauges.
*/
public static final String ALPHA = ".alpha";
/**
* The suffix for value gauges.
*/
public static final String VAL = ".val";
private final String name;
@@ -90,23 +108,24 @@ public final class RichGauge {
}
/**
* @return the name of the gauge
* Return the name of the gauge.
* @return the name
*/
public String getName() {
return this.name;
}
/**
* @return the current value
* Return the current value of the gauge.
* @return the value
*/
public double getValue() {
return this.value;
}
/**
* Either an exponential weighted moving average or a simple mean, respectively,
* depending on whether the weight 'alpha' has been set for this gauge.
*
* Return either an exponential weighted moving average or a simple mean,
* respectively, depending on whether the weight 'alpha' has been set for this gauge.
* @return The average over all the accumulated values
*/
public double getAverage() {
@@ -114,6 +133,7 @@ public final class RichGauge {
}
/**
* Return the maximum value of the gauge.
* @return the maximum value
*/
public double getMax() {
@@ -121,6 +141,7 @@ public final class RichGauge {
}
/**
* Return the minimum value of the gauge.
* @return the minimum value
*/
public double getMin() {
@@ -128,14 +149,16 @@ public final class RichGauge {
}
/**
* @return Number of times the value has been set.
* Return the number of times the value has been set.
* @return the value set count
*/
public long getCount() {
return this.count;
}
/**
* @return the smoothing constant value.
* Return the smoothing constant value.
* @return the alpha smoothing value
*/
public double getAlpha() {
return this.alpha;

View File

@@ -37,7 +37,8 @@ public interface RichGaugeReader {
Iterable<RichGauge> findAll();
/**
* @return the number of gauge values available
* Return the number of gauge values available.
* @return the number of values
*/
long count();

View File

@@ -97,8 +97,19 @@ public class SimpleInMemoryRepository<T> {
return this.values;
}
/**
* Callback used to update a value.
* @param <T> the value type
*/
public interface Callback<T> {
/**
* Modify an existing value.
* @param current the value to modify
* @return the updated value
*/
T modify(T current);
}
}

View File

@@ -32,7 +32,7 @@ import com.codahale.metrics.Timer;
/**
* A {@link MetricWriter} that send data to a Dropwizard {@link MetricRegistry} based on a
* naming convention:
* naming convention.
*
* <ul>
* <li>Updates to {@link #increment(Delta)} with names in "meter.*" are treated as

View File

@@ -15,7 +15,7 @@
*/
/**
* Support for writing metrics
* Support for writing metrics.
*/
package org.springframework.boot.actuate.metrics.writer;

View File

@@ -48,7 +48,8 @@ public class InMemoryTraceRepository implements TraceRepository {
}
/**
* @param capacity the capacity to set
* Set the capacity of the in-memory repository.
* @param capacity the capacity
*/
public void setCapacity(int capacity) {
synchronized (this.traces) {