Reformat code

This commit is contained in:
Phillip Webb
2015-09-08 14:56:40 -07:00
parent 2615990ffb
commit 67402405db
56 changed files with 188 additions and 252 deletions

View File

@@ -138,18 +138,18 @@ public class ConfigurationMetadata {
it.remove();
}
}
if (candidates.size() == 1) {
if (candidates.size() == 1) {
return candidates.get(0);
}
for (ItemMetadata candidate : candidates) {
if (ObjectUtils.nullSafeEquals(candidate.getSourceType(), metadata.getSourceType())) {
if (ObjectUtils.nullSafeEquals(candidate.getSourceType(),
metadata.getSourceType())) {
return candidate;
}
}
return null;
}
public static String nestedPrefix(String prefix, String name) {
String nestedPrefix = (prefix == null ? "" : prefix);
String dashedName = toDashedCase(name);

View File

@@ -79,7 +79,7 @@ public class ItemHint implements Comparable<ItemHint> {
public static ItemHint newHint(String name, ValueHint... values) {
return new ItemHint(name, Arrays.asList(values),
Collections.<ValueProvider> emptyList());
Collections.<ValueProvider>emptyList());
}
@Override

View File

@@ -348,8 +348,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
@Test
public void mergingOfAdditionalProperty() throws Exception {
ItemMetadata property = ItemMetadata.newProperty(null, "foo",
"java.lang.String", AdditionalMetadata.class.getName(), null, null, null,null);
ItemMetadata property = ItemMetadata.newProperty(null, "foo", "java.lang.String",
AdditionalMetadata.class.getName(), null, null, null, null);
writeAdditionalMetadata(property);
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata, containsProperty("simple.comparator"));
@@ -360,16 +360,15 @@ public class ConfigurationMetadataAnnotationProcessorTests {
@Test
public void mergeExistingPropertyDefaultValue() throws Exception {
ItemMetadata property = ItemMetadata.newProperty("simple", "flag", null,
null, null, null, true, null);
ItemMetadata property = ItemMetadata.newProperty("simple", "flag", null, null,
null, null, true, null);
writeAdditionalMetadata(property);
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(
metadata,
containsProperty("simple.flag", Boolean.class)
.fromSource(SimpleProperties.class)
.withDescription("A simple flag.")
.withDefaultValue(is(true)));
.withDescription("A simple flag.").withDefaultValue(is(true)));
assertThat(metadata.getItems().size(), is(4));
}
@@ -382,8 +381,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
assertThat(
metadata,
containsProperty("simple.comparator", "java.util.Comparator<?>")
.fromSource(SimpleProperties.class)
.withDescription("A nice comparator."));
.fromSource(SimpleProperties.class).withDescription(
"A nice comparator."));
assertThat(metadata.getItems().size(), is(4));
}
@@ -397,23 +396,23 @@ public class ConfigurationMetadataAnnotationProcessorTests {
assertThat(
metadata,
containsProperty("simple.comparator", "java.util.Comparator<?>")
.fromSource(SimpleProperties.class)
.withDeprecation("Don't use this.", "simple.complex-comparator"));
.fromSource(SimpleProperties.class).withDeprecation(
"Don't use this.", "simple.complex-comparator"));
assertThat(metadata.getItems().size(), is(4));
}
@Test
public void mergeExistingPropertyDeprecationOverride() throws Exception {
ItemMetadata property = ItemMetadata.newProperty("singledeprecated", "name", null,
null, null, null, null, new ItemDeprecation("Don't use this.",
ItemMetadata property = ItemMetadata.newProperty("singledeprecated", "name",
null, null, null, null, null, new ItemDeprecation("Don't use this.",
"single.name"));
writeAdditionalMetadata(property);
ConfigurationMetadata metadata = compile(DeprecatedSingleProperty.class);
assertThat(
metadata,
containsProperty("singledeprecated.name", String.class.getName())
.fromSource(DeprecatedSingleProperty.class)
.withDeprecation("Don't use this.", "single.name"));
.fromSource(DeprecatedSingleProperty.class).withDeprecation(
"Don't use this.", "single.name"));
assertThat(metadata.getItems().size(), is(3));
}
@@ -461,9 +460,9 @@ public class ConfigurationMetadataAnnotationProcessorTests {
@Test
public void mergingOfHintWithProvider() throws Exception {
writeAdditionalHints(new ItemHint("simple.theName",
Collections.<ItemHint.ValueHint> emptyList(), Arrays.asList(
Collections.<ItemHint.ValueHint>emptyList(), Arrays.asList(
new ItemHint.ValueProvider("first", Collections
.<String, Object> singletonMap("target", "org.foo")),
.<String, Object>singletonMap("target", "org.foo")),
new ItemHint.ValueProvider("second", null))));
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(

View File

@@ -60,7 +60,7 @@ public class JsonMarshallerTests {
metadata.add(ItemHint.newHint("c", new ItemHint.ValueHint(123, "hey"),
new ItemHint.ValueHint(456, null)));
metadata.add(new ItemHint("d", null, Arrays.asList(new ItemHint.ValueProvider(
"first", Collections.<String, Object> singletonMap("target", "foo")),
"first", Collections.<String, Object>singletonMap("target", "foo")),
new ItemHint.ValueProvider("second", null))));
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
JsonMarshaller marshaller = new JsonMarshaller();