• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

leeonky / test-charm-java / 218

15 Apr 2025 02:45PM UTC coverage: 74.045% (-0.04%) from 74.088%
218

push

circleci

leeonky
Introduce adaptiveList

20 of 21 new or added lines in 3 files covered. (95.24%)

34 existing lines in 11 files now uncovered.

7968 of 10761 relevant lines covered (74.05%)

0.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.1
/DAL-java/src/main/java/com/github/leeonky/dal/extensions/Types.java
1
package com.github.leeonky.dal.extensions;
2

3
import com.github.leeonky.dal.DAL;
4
import com.github.leeonky.dal.runtime.*;
5

6
import java.util.Collection;
7
import java.util.Map;
8
import java.util.Set;
9
import java.util.stream.Stream;
10

11
import static com.github.leeonky.dal.runtime.Order.BUILD_IN;
12

13
@Order(BUILD_IN)
14
public class Types implements Extension {
1✔
15

16
    @Override
17
    public void extend(DAL dal) {
18
        RuntimeContextBuilder builder = dal.getRuntimeContextBuilder();
1✔
19
        builder.registerPropertyAccessor(Map.class, new MapPropertyAccessor())
1✔
20
                .registerPropertyAccessor(AutoMappingList.class, new AutoMappingListPropertyAccessor())
1✔
21
                .registerDALCollectionFactory(Iterable.class, IterableDALCollection::new)
1✔
22
                .registerDALCollectionFactory(Collection.class, CollectionDALCollection::new)
1✔
23
                .registerDALCollectionFactory(Stream.class, (stream) ->
1✔
24
                        new IterableDALCollection<Object>(stream::iterator))
1✔
25
                .registerDALCollectionFactory(DALCollection.class, instance -> instance)
1✔
26
                .registerDataRemark(DataRemarkParameterAcceptor.class, remarkData ->
1✔
UNCOV
27
                        remarkData.data().instance().apply(remarkData.remark()))
×
28
                .registerPropertyAccessor(ProxyObject.class, new PropertyAccessor<ProxyObject>() {
1✔
29
                    @Override
30
                    public Object getValue(ProxyObject proxyObject, Object property) {
31
                        return proxyObject.getValue(property);
1✔
32
                    }
33

34
                    @Override
35
                    public Set<?> getPropertyNames(ProxyObject proxyObject) {
36
                        return proxyObject.getPropertyNames();
1✔
37
                    }
38

39
                    @Override
40
                    public boolean isNull(ProxyObject proxyObject) {
41
                        return proxyObject.isNull();
1✔
42
                    }
43
                })
44
                .registerReturnHook(d -> d.cast(ReturnHook.class).ifPresent(ReturnHook::onReturn))
1✔
45
                .registerDALCollectionFactory(AdaptiveList.class, AdaptiveList::list)
1✔
46
                .registerPropertyAccessor(AdaptiveList.class, new PropertyAccessor<AdaptiveList<?>>() {
1✔
47

48
                    @Override
49
                    public Data<?> getData(Data<AdaptiveList<?>> data, Object property, RuntimeContextBuilder.DALRuntimeContext context) {
50
                        data.value().only();
1✔
51
                        return data.property(data.value().list().firstIndex()).property(property);
1✔
52
                    }
53

54
                    @Override
55
                    public Set<?> getPropertyNames(Data<AdaptiveList<?>> data) {
56
                        data.value().only();
1✔
57
                        return data.property(data.value().list().firstIndex()).fieldNames();
1✔
58
                    }
59
                })
60
                .registerMetaPropertyPattern(AdaptiveList.class, ".*", new RuntimeHandler<MetaData<AdaptiveList>>() {
1✔
61
                    @Override
62
                    public Data<?> handleData(MetaData<AdaptiveList> metaData) {
63
                        if (metaData.name().equals("size"))
1✔
64
                            return metaData.delegate(d -> d.map(AdaptiveList::list));
1✔
65
                        else {
66
                            metaData.data().value().only();
1✔
67
                            return metaData.delegate(d -> d.property(d.value().list().firstIndex()));
1✔
68
                        }
69
                    }
70

71
                    @Override
72
                    public Object handle(MetaData<AdaptiveList> metaData) {
NEW
73
                        return null;
×
74
                    }
75
                })
76
        ;
77
    }
1✔
78
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc