fix(weaver-pojo-attributes-ext)!: Rename values to value for more consistency

This commit is contained in:
2025-11-08 21:29:30 +01:00
parent 577039923b
commit bf6cd05a63
5 changed files with 9 additions and 9 deletions
@@ -11,5 +11,5 @@ import java.lang.annotation.*;
@Repeatable(Attributes.class)
public @interface Attribute {
String key();
String[] values();
String[] value();
}
@@ -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);
@@ -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;
}