fix(weaver-pojo-attributes-ext)!: Rename values to value for more consistency
This commit is contained in:
+1
-1
@@ -11,5 +11,5 @@ import java.lang.annotation.*;
|
||||
@Repeatable(Attributes.class)
|
||||
public @interface Attribute {
|
||||
String key();
|
||||
String[] values();
|
||||
String[] value();
|
||||
}
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ public class AttributesPojoWeavingProcessor implements TweedPojoWeavingExtension
|
||||
@Override
|
||||
public <T> void afterWeaveEntry(ActualType<T> valueType, ConfigEntry<T> configEntry, WeavingContext context) {
|
||||
val attributeAnnotations = context.annotations().getAnnotationsByType(Attribute.class);
|
||||
val attributes = collectAttributesFromAnnotations(attributeAnnotations, Attribute::key, Attribute::values);
|
||||
val attributes = collectAttributesFromAnnotations(attributeAnnotations, Attribute::key, Attribute::value);
|
||||
attributes.forEach((key, values) -> attributesExtension.setAttribute(configEntry, key, values));
|
||||
|
||||
val attributeDefaultAnnotations = context.annotations().getAnnotationsByType(AttributeDefault.class);
|
||||
|
||||
+4
-4
@@ -72,19 +72,19 @@ class AttributesPojoWeavingProcessorTest {
|
||||
@PojoWeavingExtension(AttributesPojoWeavingProcessor.class)
|
||||
@CompoundWeaving
|
||||
public static class Config {
|
||||
@Attribute(key = "scope", values = "game")
|
||||
@Attribute(key = "scope", value = "game")
|
||||
public String string;
|
||||
@Attribute(key = "color", values = "green")
|
||||
@Attribute(key = "color", value = "green")
|
||||
public SubConfig sub1;
|
||||
@AttributeDefault(key = "color", defaultValue = "green")
|
||||
@AttributeDefault(key = "scope", defaultValue = "game")
|
||||
@Attribute(key = "scope", values = "world")
|
||||
@Attribute(key = "scope", value = "world")
|
||||
public SubConfig sub2;
|
||||
}
|
||||
|
||||
@CompoundWeaving
|
||||
public static class SubConfig {
|
||||
@Attribute(key = "color", values = "red")
|
||||
@Attribute(key = "color", value = "red")
|
||||
public String a;
|
||||
public String b;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user