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

leeonky / test-charm-java / 293

12 Sep 2025 04:43PM UTC coverage: 74.22% (-0.09%) from 74.312%
293

push

circleci

leeonky
create sub list from spec list in spec

33 of 42 new or added lines in 8 files covered. (78.57%)

32 existing lines in 11 files now uncovered.

8234 of 11094 relevant lines covered (74.22%)

0.74 hits per line

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

38.46
/bean-util/src/main/java/com/github/leeonky/util/Property.java
1
package com.github.leeonky.util;
2

3
import java.util.Arrays;
4
import java.util.List;
5

6
import static java.util.stream.Collectors.toList;
7

8
public interface Property<T> {
9
    static List<Object> toChainNodes(String chain) {
10
        return Arrays.stream(chain.split("[\\[\\].]")).filter(s -> !s.isEmpty()).map(s -> {
1✔
11
            try {
12
                return Integer.valueOf(s);
1✔
13
            } catch (Exception ignore) {
1✔
14
                return s;
1✔
15
            }
16
        }).collect(toList());
1✔
17
    }
18

19
    String getName();
20

21
    BeanClass<T> getBeanType();
22

23
    PropertyReader<T> getReader();
24

25
    PropertyWriter<T> getWriter();
26

27
    @SuppressWarnings("unchecked")
28
    default <P> BeanClass<P> getReaderType() {
29
        return (BeanClass<P>) getReader().getType();
1✔
30
    }
31

32
    @SuppressWarnings("unchecked")
33
    default <P> BeanClass<P> getWriterType() {
34
        return (BeanClass<P>) getWriter().getType();
1✔
35
    }
36

37
    default Property<T> setValue(T instance, Object value) {
38
        getWriter().setValue(instance, value);
1✔
39
        return this;
1✔
40
    }
41

42
    @SuppressWarnings("unchecked")
43
    default <P> P getValue(T instance) {
44
        return (P) getReader().getValue(instance);
1✔
45
    }
46

47
    default Property<T> decorateNarrowReaderType(BeanClass<? extends T> narrowType) {
UNCOV
48
        PropertyReader<T> reader = getReader();
×
UNCOV
49
        if (reader.getType().equals(narrowType))
×
UNCOV
50
            return this;
×
UNCOV
51
        Class<?> type = reader.getOriginType().getType();
×
UNCOV
52
        if (narrowType.isInheritedFrom(type))
×
UNCOV
53
            return new PropertyDecorator<T>(this) {
×
54
                @Override
55
                public PropertyReader<T> getReader() {
UNCOV
56
                    return reader.decorateType(narrowType);
×
57
                }
58
            };
UNCOV
59
        throw new IllegalStateException("Type " + narrowType.getType() + " is not inherited from " + type);
×
60
    }
61

62
    default Property<T> decorateNarrowWriterType(BeanClass<? extends T> narrowType) {
UNCOV
63
        PropertyWriter<T> writer = getWriter();
×
UNCOV
64
        if (writer.getType().equals(narrowType))
×
UNCOV
65
            return this;
×
UNCOV
66
        Class<?> type = writer.getOriginType().getType();
×
UNCOV
67
        if (narrowType.isInheritedFrom(type))
×
UNCOV
68
            return new PropertyDecorator<T>(this) {
×
69
                @Override
70
                public PropertyWriter<T> getWriter() {
UNCOV
71
                    return writer.decorateType(narrowType);
×
72
                }
73
            };
UNCOV
74
        throw new IllegalStateException("Type " + narrowType.getType() + " is not inherited from " + type);
×
75
    }
76
}
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