use of org.gradle.api.internal.changedetection.state.CoercingStringValueSnapshot in project gradle by gradle.
the class AttributeContainerSerializer method read.
@Override
public ImmutableAttributes read(Decoder decoder) throws IOException {
ImmutableAttributes attributes = ImmutableAttributes.EMPTY;
int count = decoder.readSmallInt();
for (int i = 0; i < count; i++) {
String name = decoder.readString();
byte type = decoder.readByte();
if (type == BOOLEAN_ATTRIBUTE) {
attributes = attributesFactory.concat(attributes, Attribute.of(name, Boolean.class), decoder.readBoolean());
} else {
String value = decoder.readString();
attributes = attributesFactory.concat(attributes, Attribute.of(name, String.class), new CoercingStringValueSnapshot(value, instantiator));
}
}
return attributes;
}
use of org.gradle.api.internal.changedetection.state.CoercingStringValueSnapshot in project gradle by gradle.
the class ModuleMetadataParser method consumeAttributes.
private ImmutableAttributes consumeAttributes(JsonReader reader) throws IOException {
ImmutableAttributes attributes = ImmutableAttributes.EMPTY;
reader.beginObject();
while (reader.peek() != END_OBJECT) {
String attrName = reader.nextName();
if (reader.peek() == BOOLEAN) {
boolean attrValue = reader.nextBoolean();
attributes = attributesFactory.concat(attributes, Attribute.of(attrName, Boolean.class), attrValue);
} else {
String attrValue = reader.nextString();
attributes = attributesFactory.concat(attributes, Attribute.of(attrName, String.class), new CoercingStringValueSnapshot(attrValue, instantiator));
}
}
reader.endObject();
return attributes;
}
Aggregations