This commit is contained in:
Phillip Webb
2017-12-13 13:54:22 -08:00
parent 5ca608330c
commit 3273859fde
26 changed files with 83 additions and 75 deletions

View File

@@ -416,14 +416,13 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
if (endpointId == null || "".equals(endpointId)) {
return; // Can't process that endpoint
}
String endpointKey = ItemMetadata.newItemMetadataPrefix(
"management.endpoint.", endpointId);
String endpointKey = ItemMetadata.newItemMetadataPrefix("management.endpoint.",
endpointId);
Boolean enabledByDefault = (Boolean) elementValues.get("enableByDefault");
String type = this.typeUtils.getQualifiedName(element);
this.metadataCollector
.add(ItemMetadata.newGroup(endpointKey, type, type, null));
this.metadataCollector.add(ItemMetadata.newProperty(endpointKey,
"enabled", Boolean.class.getName(), type, null,
this.metadataCollector.add(ItemMetadata.newGroup(endpointKey, type, type, null));
this.metadataCollector.add(ItemMetadata.newProperty(endpointKey, "enabled",
Boolean.class.getName(), type, null,
String.format("Whether to enable the %s endpoint.", endpointId),
(enabledByDefault == null ? true : enabledByDefault), null));
this.metadataCollector.add(ItemMetadata.newProperty(endpointKey,

View File

@@ -218,8 +218,8 @@ public final class ItemMetadata implements Comparable<ItemMetadata> {
}
public static String newItemMetadataPrefix(String prefix, String suffix) {
return prefix.toLowerCase(Locale.ENGLISH) +
ConfigurationMetadata.toDashedCase(suffix);
return prefix.toLowerCase(Locale.ENGLISH)
+ ConfigurationMetadata.toDashedCase(suffix);
}
/**

View File

@@ -636,9 +636,10 @@ public class ConfigurationMetadataAnnotationProcessorTests {
private Metadata.MetadataItemCondition enabledFlag(String endpointId,
String endpointSuffix, Boolean defaultValue) {
return Metadata.withEnabledFlag("management.endpoint." + endpointSuffix
+ ".enabled").withDefaultValue(defaultValue).withDescription(
String.format("Whether to enable the %s endpoint.", endpointId));
return Metadata
.withEnabledFlag("management.endpoint." + endpointSuffix + ".enabled")
.withDefaultValue(defaultValue).withDescription(
String.format("Whether to enable the %s endpoint.", endpointId));
}
private Metadata.MetadataItemCondition enabledFlag(String endpointId,