fix(weaver-pojo-attributes-ext)!: Rename values to value for more consistency
This commit is contained in:
@@ -20,9 +20,9 @@ public class TweedCoatBridgeTestModConfig {
|
||||
@Validator(value = WeavableNumberRangeValidator.class, config = "-10=..=10")
|
||||
private int integerInRange = -5;
|
||||
|
||||
@Attribute(key = TweedCoatAttributes.BACKGROUND_TEXTURE, values = "textures/block/green_terracotta.png")
|
||||
@Attribute(key = TweedCoatAttributes.BACKGROUND_TEXTURE, value = "textures/block/green_terracotta.png")
|
||||
private Greeting serverGreeting = new Greeting("Hello server!", "Server");
|
||||
@Attribute(key = TweedCoatAttributes.BACKGROUND_TEXTURE, values = "textures/block/red_terracotta.png")
|
||||
@Attribute(key = TweedCoatAttributes.BACKGROUND_TEXTURE, value = "textures/block/red_terracotta.png")
|
||||
private Greeting clientGreeting = new Greeting("Hello client!", "Client");
|
||||
|
||||
@CompoundWeaving
|
||||
|
||||
@@ -13,7 +13,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class TestModConfig {
|
||||
private String helloStart = "Minecraft";
|
||||
@Attribute(key = "scope", values = "game")
|
||||
@Attribute(key = "scope", value = "game")
|
||||
private String helloInGame = "Game";
|
||||
private String helloEnd = "!";
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user