Stop using deprecated AttributeSetter outside of the deprecated package
MODIFY
instrumentation-api-annotation-support/src/main/java/io/opentelemetry/instrumentation/api/annotation/support/AttributeBinding.java
instrumentation-api-annotation-support/src/main/java/io/opentelemetry/instrumentation/api/annotation/support/AttributeBinding.java
package io.opentelemetry.instrumentation.api.annotation.support;
-import io.opentelemetry.instrumentation.api.tracer.AttributeSetter;
+import io.opentelemetry.api.common.AttributesBuilder;
/** Represents the binding of a method parameter to an attribute of a traced method. */
@FunctionalInterface
-public interface AttributeBinding {
+interface AttributeBinding {
/**
* Applies the value of the method argument as an attribute on the span for the traced method.
*
- * @param setter the {@link AttributeSetter} onto which to add the attribute
+ * @param target the {@link AttributesBuilder} onto which to add the attribute
* @param arg the value of the method argument
*/
- void apply(AttributeSetter setter, Object arg);
+ void apply(AttributesBuilder target, Object arg);
}

MODIFY
instrumentation-api-annotation-support/src/main/java/io/opentelemetry/instrumentation/api/annotation/support/AttributeBindingFactory.java
instrumentation-api-annotation-support/src/main/java/io/opentelemetry/instrumentation/api/annotation/support/AttributeBindingFactory.java
@@ -25,27 +25,27 @@ class AttributeBindingFactory {
// Simple scalar parameter types
if (type == String.class) {
AttributeKey<String> key = AttributeKey.stringKey(name);
- return (setter, arg) -> setter.setAttribute(key, (String) arg);
+ return (setter, arg) -> setter.put(key, (String) arg);
}
if (type == long.class || type == Long.class) {
AttributeKey<Long> key = AttributeKey.longKey(name);
- return (setter, arg) -> setter.setAttribute(key, (Long) arg);
+ return (setter, arg) -> setter.put(key, (Long) arg);
}
if (type == double.class || type == Double.class) {
AttributeKey<Double> key = AttributeKey.doubleKey(name);
- return (setter, arg) -> setter.setAttribute(key, (Double) arg);
+ return (setter, arg) -> setter.put(key, (Double) arg);
}
if (type == boolean.class || type == Boolean.class) {
AttributeKey<Boolean> key = AttributeKey.booleanKey(name);
- return (setter, arg) -> setter.setAttribute(key, (Boolean) arg);
+ return (setter, arg) -> setter.put(key, (Boolean) arg);
}
if (type == int.class || type == Integer.class) {
AttributeKey<Long> key = AttributeKey.longKey(name);
- return (setter, arg) -> setter.setAttribute(key, ((Integer) arg).longValue());
+ return (setter, arg) -> setter.put(key, ((Integer) arg).longValue());
}
if (type == float.class || type == Float.class) {
AttributeKey<Double> key = AttributeKey.doubleKey(name);
- return (setter, arg) -> setter.setAttribute(key, ((Float) arg).doubleValue());
+ return (setter, arg) -> setter.put(key, ((Float) arg).doubleValue());
}
if (isArrayType(type)) {
@@ -74,19 +74,19 @@ class AttributeBindingFactory {
// Simple array attribute types without conversion
if (type == String[].class) {
AttributeKey<List<String>> key = AttributeKey.stringArrayKey(name);
- return (setter, arg) -> setter.setAttribute(key, Arrays.asList((String[]) arg));
+ return (setter, arg) -> setter.put(key, Arrays.asList((String[]) arg));
}
if (type == Long[].class) {
AttributeKey<List<Long>> key = AttributeKey.longArrayKey(name);
- return (setter, arg) -> setter.setAttribute(key, Arrays.asList((Long[]) arg));
+ return (setter, arg) -> setter.put(key, Arrays.asList((Long[]) arg));
}
if (type == Double[].class) {
AttributeKey<List<Double>> key = AttributeKey.doubleArrayKey(name);
- return (setter, arg) -> setter.setAttribute(key, Arrays.asList((Double[]) arg));
+ return (setter, arg) -> setter.put(key, Arrays.asList((Double[]) arg));
}
if (type == Boolean[].class) {
AttributeKey<List<Boolean>> key = AttributeKey.booleanArrayKey(name);
- return (setter, arg) -> setter.setAttribute(key, Arrays.asList((Boolean[]) arg));
+ return (setter, arg) -> setter.put(key, Arrays.asList((Boolean[]) arg));
}
if (type == long[].class) {
@@ -118,19 +118,19 @@ class AttributeBindingFactory {
private static AttributeBinding listBinding(String name, Type componentType) {
if (componentType == String.class) {
AttributeKey<List<String>> key = AttributeKey.stringArrayKey(name);
- return (setter, arg) -> setter.setAttribute(key, (List<String>) arg);
+ return (setter, arg) -> setter.put(key, (List<String>) arg);
}
if (componentType == Long.class) {
AttributeKey<List<Long>> key = AttributeKey.longArrayKey(name);
- return (setter, arg) -> setter.setAttribute(key, (List<Long>) arg);
+ return (setter, arg) -> setter.put(key, (List<Long>) arg);
}
if (componentType == Double.class) {
AttributeKey<List<Double>> key = AttributeKey.doubleArrayKey(name);
- return (setter, arg) -> setter.setAttribute(key, (List<Double>) arg);
+ return (setter, arg) -> setter.put(key, (List<Double>) arg);
}
if (componentType == Boolean.class) {
AttributeKey<List<Boolean>> key = AttributeKey.booleanArrayKey(name);
- return (setter, arg) -> setter.setAttribute(key, (List<Boolean>) arg);
+ return (setter, arg) -> setter.put(key, (List<Boolean>) arg);
}
if (componentType == Integer.class) {
AttributeKey<List<Long>> key = AttributeKey.longArrayKey(name);
@@ -160,7 +160,7 @@ class AttributeBindingFactory {
return array.length;
}
};
- setter.setAttribute(key, wrapper);
+ setter.put(key, wrapper);
};
}
@@ -181,7 +181,7 @@ class AttributeBindingFactory {
return array.length;
}
};
- setter.setAttribute(key, wrapper);
+ setter.put(key, wrapper);
};
}
@@ -201,7 +201,7 @@ class AttributeBindingFactory {
return array.length;
}
};
- setter.setAttribute(key, wrapper);
+ setter.put(key, wrapper);
};
}
@@ -221,7 +221,7 @@ class AttributeBindingFactory {
return array.length;
}
};
- setter.setAttribute(key, wrapper);
+ setter.put(key, wrapper);
};
}
@@ -242,7 +242,7 @@ class AttributeBindingFactory {
return array.length;
}
};
- setter.setAttribute(key, wrapper);
+ setter.put(key, wrapper);
};
}
@@ -262,7 +262,7 @@ class AttributeBindingFactory {
return array.length;
}
};
- setter.setAttribute(key, wrapper);
+ setter.put(key, wrapper);
};
}
@@ -282,7 +282,7 @@ class AttributeBindingFactory {
return array.length;
}
};
- setter.setAttribute(key, wrapper);
+ setter.put(key, wrapper);
};
}
@@ -303,7 +303,7 @@ class AttributeBindingFactory {
return array.length;
}
};
- setter.setAttribute(key, wrapper);
+ setter.put(key, wrapper);
};
}
@@ -325,7 +325,7 @@ class AttributeBindingFactory {
return list.size();
}
};
- setter.setAttribute(key, wrapper);
+ setter.put(key, wrapper);
};
}
@@ -336,6 +336,6 @@ class AttributeBindingFactory {
private static AttributeBinding defaultBinding(String name) {
AttributeKey<String> key = AttributeKey.stringKey(name);
- return (setter, arg) -> setter.setAttribute(key, arg.toString());
+ return (setter, arg) -> setter.put(key, arg.toString());
}
}

MODIFY
instrumentation-api-annotation-support/src/main/java/io/opentelemetry/instrumentation/api/annotation/support/AttributeBindings.java
instrumentation-api-annotation-support/src/main/java/io/opentelemetry/instrumentation/api/annotation/support/AttributeBindings.java
package io.opentelemetry.instrumentation.api.annotation.support;
-import io.opentelemetry.instrumentation.api.tracer.AttributeSetter;
+import io.opentelemetry.api.common.AttributesBuilder;
/** Represents the bindings of method parameters to attributes of a traced method. */
-public interface AttributeBindings {
+interface AttributeBindings {
/**
* Indicates that the traced method has no parameters bound to attributes.
@@ -20,8 +20,8 @@ public interface AttributeBindings {
/**
* Applies the values of the method arguments as attributes on the span for the traced method.
*
- * @param setter the {@link AttributeSetter} for setting the attribute on the span
+ * @param target the {@link AttributesBuilder} on which to set the attribute
* @param args the method arguments
*/
- void apply(AttributeSetter setter, Object[] args);
+ void apply(AttributesBuilder target, Object[] args);
}

MODIFY
instrumentation-api-annotation-support/src/main/java/io/opentelemetry/instrumentation/api/annotation/support/MethodSpanAttributesExtractor.java
instrumentation-api-annotation-support/src/main/java/io/opentelemetry/instrumentation/api/annotation/support/MethodSpanAttributesExtractor.java
@@ -8,7 +8,6 @@ package io.opentelemetry.instrumentation.api.annotation.support;
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.instrumentation.api.cache.Cache;
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
-import io.opentelemetry.instrumentation.api.tracer.AttributeSetter;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import javax.annotation.Nullable;
@@ -51,7 +50,7 @@ public final class MethodSpanAttributesExtractor<REQUEST, RESPONSE>
AttributeBindings bindings = cache.computeIfAbsent(method, this::bind);
if (!bindings.isEmpty()) {
Object[] args = methodArgumentsExtractor.extract(request);
- bindings.apply(attributes::put, args);
+ bindings.apply(attributes, args);
}
}
@@ -108,7 +107,7 @@ public final class MethodSpanAttributesExtractor<REQUEST, RESPONSE>
}
@Override
- public void apply(AttributeSetter setter, Object[] args) {}
+ public void apply(AttributesBuilder target, Object[] args) {}
}
private static final class CombinedAttributeBindings implements AttributeBindings {
@@ -129,12 +128,12 @@ public final class MethodSpanAttributesExtractor<REQUEST, RESPONSE>
}
@Override
- public void apply(AttributeSetter setter, Object[] args) {
- parent.apply(setter, args);
+ public void apply(AttributesBuilder target, Object[] args) {
+ parent.apply(target, args);
if (args != null && args.length > index) {
Object arg = args[index];
if (arg != null) {
- binding.apply(setter, arg);
+ binding.apply(target, arg);
}
}
}

MODIFY
instrumentation-api-annotation-support/src/test/groovy/io/opentelemetry/instrumentation/api/annotation/support/AttributeBindingFactoryTest.groovy
instrumentation-api-annotation-support/src/test/groovy/io/opentelemetry/instrumentation/api/annotation/support/AttributeBindingFactoryTest.groovy
package io.opentelemetry.instrumentation.api.annotation.support
import io.opentelemetry.api.common.AttributeType
-import io.opentelemetry.instrumentation.api.tracer.AttributeSetter
+import io.opentelemetry.api.common.AttributesBuilder
import spock.lang.Specification
class AttributeBindingFactoryTest extends Specification {
- AttributeSetter setter = Mock()
+ AttributesBuilder setter = Mock()
def "creates attribute binding for String"() {
when:
AttributeBindingFactory.createBinding("key", String).apply(setter, "value")
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.STRING && it.getKey() == "key" }, "value")
+ 1 * setter.put({ it.getType() == AttributeType.STRING && it.getKey() == "key" }, "value")
}
def "creates attribute binding for int"() {
@@ -26,7 +26,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", int).apply(setter, 1234)
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.LONG && it.getKey() == "key" }, 1234L)
+ 1 * setter.put({ it.getType() == AttributeType.LONG && it.getKey() == "key" }, 1234L)
}
def "creates attribute binding for Integer"() {
@@ -34,7 +34,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", Integer).apply(setter, 1234)
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.LONG && it.getKey() == "key" }, 1234L)
+ 1 * setter.put({ it.getType() == AttributeType.LONG && it.getKey() == "key" }, 1234L)
}
def "creates attribute binding for long"() {
@@ -42,7 +42,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", long).apply(setter, 1234L)
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.LONG && it.getKey() == "key" }, 1234L)
+ 1 * setter.put({ it.getType() == AttributeType.LONG && it.getKey() == "key" }, 1234L)
}
def "creates attribute binding for Long"() {
@@ -50,7 +50,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", Long).apply(setter, 1234L)
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.LONG && it.getKey() == "key" }, 1234L)
+ 1 * setter.put({ it.getType() == AttributeType.LONG && it.getKey() == "key" }, 1234L)
}
def "creates attribute binding for float"() {
@@ -58,7 +58,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", float).apply(setter, 1234.0F)
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.DOUBLE && it.getKey() == "key" }, 1234.0)
+ 1 * setter.put({ it.getType() == AttributeType.DOUBLE && it.getKey() == "key" }, 1234.0)
}
def "creates attribute binding for Float"() {
@@ -66,7 +66,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", Float).apply(setter, 1234.0F)
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.DOUBLE && it.getKey() == "key" }, 1234.0)
+ 1 * setter.put({ it.getType() == AttributeType.DOUBLE && it.getKey() == "key" }, 1234.0)
}
def "creates attribute binding for double"() {
@@ -74,7 +74,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", double).apply(setter, Double.valueOf(1234.0))
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.DOUBLE && it.getKey() == "key" }, Double.valueOf(1234.0))
+ 1 * setter.put({ it.getType() == AttributeType.DOUBLE && it.getKey() == "key" }, Double.valueOf(1234.0))
}
def "creates attribute binding for Double"() {
@@ -82,7 +82,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", Double).apply(setter, Double.valueOf(1234.0))
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.DOUBLE && it.getKey() == "key" }, Double.valueOf(1234.0))
+ 1 * setter.put({ it.getType() == AttributeType.DOUBLE && it.getKey() == "key" }, Double.valueOf(1234.0))
}
def "creates attribute binding for boolean"() {
@@ -90,7 +90,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", boolean).apply(setter, true)
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.BOOLEAN && it.getKey() == "key" }, true)
+ 1 * setter.put({ it.getType() == AttributeType.BOOLEAN && it.getKey() == "key" }, true)
}
def "creates attribute binding for Boolean"() {
@@ -98,7 +98,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", Boolean).apply(setter, true)
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.BOOLEAN && it.getKey() == "key" }, true)
+ 1 * setter.put({ it.getType() == AttributeType.BOOLEAN && it.getKey() == "key" }, true)
}
def "creates attribute binding for String[]"() {
@@ -106,7 +106,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", String[]).apply(setter, ["x", "y", "z", null] as String[])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.STRING_ARRAY && it.getKey() == "key" }, ["x", "y", "z", null])
+ 1 * setter.put({ it.getType() == AttributeType.STRING_ARRAY && it.getKey() == "key" }, ["x", "y", "z", null])
}
def "creates attribute binding for int[]"() {
@@ -114,7 +114,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", int[]).apply(setter, [1, 2, 3] as int[])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.LONG_ARRAY && it.getKey() == "key" }, [1L, 2L, 3L])
+ 1 * setter.put({ it.getType() == AttributeType.LONG_ARRAY && it.getKey() == "key" }, [1L, 2L, 3L])
}
def "creates attribute binding for Integer[]"() {
@@ -122,7 +122,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", Integer[]).apply(setter, [1, 2, 3, null] as Integer[])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.LONG_ARRAY && it.getKey() == "key" }, [1L, 2L, 3L, null])
+ 1 * setter.put({ it.getType() == AttributeType.LONG_ARRAY && it.getKey() == "key" }, [1L, 2L, 3L, null])
}
def "creates attribute binding for long[]"() {
@@ -130,7 +130,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", long[]).apply(setter, [1L, 2L, 3L] as long[])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.LONG_ARRAY && it.getKey() == "key" }, [1L, 2L, 3L])
+ 1 * setter.put({ it.getType() == AttributeType.LONG_ARRAY && it.getKey() == "key" }, [1L, 2L, 3L])
}
def "creates attribute binding for Long[]"() {
@@ -138,7 +138,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", Long[]).apply(setter, [1L, 2L, 3L, null] as Long[])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.LONG_ARRAY && it.getKey() == "key" }, [1L, 2L, 3L, null])
+ 1 * setter.put({ it.getType() == AttributeType.LONG_ARRAY && it.getKey() == "key" }, [1L, 2L, 3L, null])
}
def "creates attribute binding for float[]"() {
@@ -146,7 +146,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", float[]).apply(setter, [1.0F, 2.0F, 3.0F] as float[])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.DOUBLE_ARRAY && it.getKey() == "key" }, [1.0, 2.0, 3.0] as List<Double>)
+ 1 * setter.put({ it.getType() == AttributeType.DOUBLE_ARRAY && it.getKey() == "key" }, [1.0, 2.0, 3.0] as List<Double>)
}
def "creates attribute binding for Float[]"() {
@@ -154,7 +154,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", Float[]).apply(setter, [1.0F, 2.0F, 3.0F, null] as Float[])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.DOUBLE_ARRAY && it.getKey() == "key" }, [1.0, 2.0, 3.0, null] as List<Double>)
+ 1 * setter.put({ it.getType() == AttributeType.DOUBLE_ARRAY && it.getKey() == "key" }, [1.0, 2.0, 3.0, null] as List<Double>)
}
def "creates attribute binding for double[]"() {
@@ -162,7 +162,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", double[]).apply(setter, [1.0, 2.0, 3.0] as double[])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.DOUBLE_ARRAY && it.getKey() == "key" }, [1.0, 2.0, 3.0] as List<Double>)
+ 1 * setter.put({ it.getType() == AttributeType.DOUBLE_ARRAY && it.getKey() == "key" }, [1.0, 2.0, 3.0] as List<Double>)
}
def "creates attribute binding for Double[]"() {
@@ -170,7 +170,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", Double[]).apply(setter, [1.0, 2.0, 3.0, null] as Double[])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.DOUBLE_ARRAY && it.getKey() == "key" }, [1.0, 2.0, 3.0, null] as List<Double>)
+ 1 * setter.put({ it.getType() == AttributeType.DOUBLE_ARRAY && it.getKey() == "key" }, [1.0, 2.0, 3.0, null] as List<Double>)
}
def "creates attribute binding for boolean[]"() {
@@ -178,7 +178,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", boolean[]).apply(setter, [true, false] as boolean[])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.BOOLEAN_ARRAY && it.getKey() == "key" }, [true, false] as List<Boolean>)
+ 1 * setter.put({ it.getType() == AttributeType.BOOLEAN_ARRAY && it.getKey() == "key" }, [true, false] as List<Boolean>)
}
def "creates attribute binding for Boolean[]"() {
@@ -186,7 +186,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", Boolean[]).apply(setter, [true, false, null] as Boolean[])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.BOOLEAN_ARRAY && it.getKey() == "key" }, [true, false, null] as List<Boolean>)
+ 1 * setter.put({ it.getType() == AttributeType.BOOLEAN_ARRAY && it.getKey() == "key" }, [true, false, null] as List<Boolean>)
}
def "creates default attribute binding"() {
@@ -194,7 +194,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", TestClass).apply(setter, new TestClass("foo"))
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.STRING && it.getKey() == "key" }, "TestClass{value = foo}")
+ 1 * setter.put({ it.getType() == AttributeType.STRING && it.getKey() == "key" }, "TestClass{value = foo}")
}
def "creates default attribute binding for array"() {
@@ -202,7 +202,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", TestClass[]).apply(setter, [new TestClass("foo"), new TestClass("bar"), null] as TestClass[])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.STRING_ARRAY && it.getKey() == "key" }, ["TestClass{value = foo}", "TestClass{value = bar}", null])
+ 1 * setter.put({ it.getType() == AttributeType.STRING_ARRAY && it.getKey() == "key" }, ["TestClass{value = foo}", "TestClass{value = bar}", null])
}
def "creates attribute binding for List<String>"() {
@@ -211,7 +211,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", type).apply(setter, ["x", "y", "z"])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.STRING_ARRAY && it.getKey() == "key" }, ["x", "y", "z"])
+ 1 * setter.put({ it.getType() == AttributeType.STRING_ARRAY && it.getKey() == "key" }, ["x", "y", "z"])
}
def "creates attribute binding for List<Integer>"() {
@@ -220,7 +220,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", type).apply(setter, [1, 2, 3])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.LONG_ARRAY && it.getKey() == "key" }, [1L, 2L, 3L])
+ 1 * setter.put({ it.getType() == AttributeType.LONG_ARRAY && it.getKey() == "key" }, [1L, 2L, 3L])
}
def "creates attribute binding for List<Long>"() {
@@ -229,7 +229,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", type).apply(setter, [1L, 2L, 3L])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.LONG_ARRAY && it.getKey() == "key" }, [1L, 2L, 3L])
+ 1 * setter.put({ it.getType() == AttributeType.LONG_ARRAY && it.getKey() == "key" }, [1L, 2L, 3L])
}
def "creates attribute binding for List<Float>"() {
@@ -238,7 +238,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", type).apply(setter, [1.0F, 2.0F, 3.0F])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.DOUBLE_ARRAY && it.getKey() == "key" }, [1.0, 2.0, 3.0])
+ 1 * setter.put({ it.getType() == AttributeType.DOUBLE_ARRAY && it.getKey() == "key" }, [1.0, 2.0, 3.0])
}
def "creates attribute binding for List<Double>"() {
@@ -247,7 +247,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", type).apply(setter, [1.0, 2.0, 3.0])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.DOUBLE_ARRAY && it.getKey() == "key" }, [1.0, 2.0, 3.0])
+ 1 * setter.put({ it.getType() == AttributeType.DOUBLE_ARRAY && it.getKey() == "key" }, [1.0, 2.0, 3.0])
}
def "creates attribute binding for List<Boolean>"() {
@@ -256,7 +256,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", type).apply(setter, [true, false, null])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.BOOLEAN_ARRAY && it.getKey() == "key" }, [true, false, null])
+ 1 * setter.put({ it.getType() == AttributeType.BOOLEAN_ARRAY && it.getKey() == "key" }, [true, false, null])
}
def "creates attribute binding for List<?>"() {
@@ -265,7 +265,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", type).apply(setter, [new TestClass("foo"), new TestClass("bar")])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.STRING_ARRAY && it.getKey() == "key" }, ["TestClass{value = foo}", "TestClass{value = bar}"])
+ 1 * setter.put({ it.getType() == AttributeType.STRING_ARRAY && it.getKey() == "key" }, ["TestClass{value = foo}", "TestClass{value = bar}"])
}
def "creates attribute binding for ArrayList<Long>"() {
@@ -274,7 +274,7 @@ class AttributeBindingFactoryTest extends Specification {
AttributeBindingFactory.createBinding("key", type).apply(setter, [1L, 2L, 3L])
then:
- 1 * setter.setAttribute({ it.getType() == AttributeType.LONG_ARRAY && it.getKey() == "key" }, [1L, 2L, 3L])
+ 1 * setter.put({ it.getType() == AttributeType.LONG_ARRAY && it.getKey() == "key" }, [1L, 2L, 3L])
}
class TestClass {

Stop using deprecated AttributeSetter outside of the deprecated package (#5038)