MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / asMap_set

Method asMap_set

src/main/java/field/graphics/FLine.java:1610–1657  ·  view source on GitHub ↗
(String name, Object value)

Source from the content-addressed store, hash-verified

1608// if (value instanceof ConsString) value = value.toString(); //jdk9 module security breaks this
1609 if (value != null && value.getClass().getName().endsWith("ConsString")) value = "" + value;
1610
1611 Dict.Prop canon = new Dict.Prop(name).toCanon();
1612
1613 if (canon.getAttributes().isTrue(Dict.readOnly, false))
1614 throw new IllegalArgumentException("can't write to property " + name);
1615
1616 if (value instanceof ThreadSync2.TrappedSet) {
1617 Object firstValue = ((ThreadSync2.TrappedSet) value).next();
1618
1619 Object r = asMap_set(name, firstValue);
1620
1621 new Drivers().provokeCurrentFibre(System.identityHashCode(this) + "_" + name, new Function1<Object, Object>() {
1622
1623 Object was = null;
1624
1625 @Override
1626 public Object invoke(Object o) {
1627 if (o != null && !safeEq(was, o)) {
1628 was = o;
1629 modify();
1630 asMap_set(name, o);
1631 }
1632 return o;
1633 }
1634 }, ((ThreadSync2.TrappedSet) value));
1635
1636 return r;
1637 }
1638
1639 Function<Object, Object> c = canon.getAttributes().get(Dict.customCaster);
1640 if (c != null)
1641 value = c.apply(value);
1642 Object converted = convert(value, canon.getTypeInformation());
1643
1644 attributes.put(canon, converted);
1645
1646
1647 modify();
1648
1649 return this;
1650 }
1651
1652 @Override
1653 @HiddenInAutocomplete
1654 public boolean asMap_delete(Object o) {
1655 modify();
1656 return attributes.asMap_delete(o);
1657 }
1658
1659 @HiddenInAutocomplete
1660 public Object convert(Object value, List<Class> fit) {

Callers 4

FLineMethod · 0.95
invokeMethod · 0.95
asMap_callMethod · 0.95
asMap_newMethod · 0.95

Calls 12

convertMethod · 0.95
modifyMethod · 0.95
toCanonMethod · 0.80
isTrueMethod · 0.80
getAttributesMethod · 0.80
provokeCurrentFibreMethod · 0.80
getTypeInformationMethod · 0.80
nextMethod · 0.65
getMethod · 0.65
applyMethod · 0.65
getNameMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected