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

AuthMe / ConfigMe / 6022426951

30 Aug 2023 08:26AM UTC coverage: 97.279% (+3.7%) from 93.592%
6022426951

push

github

ljacqu
Draft: collection property types (3)

528 of 546 branches covered (0.0%)

45 of 45 new or added lines in 12 files covered. (100.0%)

1466 of 1507 relevant lines covered (97.28%)

4.44 hits per line

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

88.89
/src/main/java/ch/jalu/configme/properties/types/StringType.java
1
package ch.jalu.configme.properties.types;
2

3
import ch.jalu.configme.properties.convertresult.ConvertErrorRecorder;
4
import org.jetbrains.annotations.NotNull;
5
import org.jetbrains.annotations.Nullable;
6

7
import java.util.Locale;
8

9
/**
10
 * Property type and mapper leaf type for strings.
11
 */
12
public class StringType extends PropertyAndLeafType<String> {
13

14
    /** Default string type. */
15
    public static final StringType STRING = new StringType();
4✔
16

17
    /** Lowercase string type. */
18
    public static final StringType STRING_LOWER_CASE = new StringType() {
8✔
19
        @Override
20
        protected @NotNull String transformToString(@NotNull Object object) {
21
            return object.toString().toLowerCase(Locale.ROOT);
5✔
22
        }
23
    };
24

25
    /**
26
     * Constructor.
27
     */
28
    protected StringType() {
29
        super(String.class);
3✔
30
    }
1✔
31

32
    @Override
33
    public @Nullable String convert(@Nullable Object object, @NotNull ConvertErrorRecorder errorRecorder) {
34
        return object == null ? null : transformToString(object);
8✔
35
    }
36

37
    @Override
38
    public @NotNull String toExportValue(@NotNull String value) {
39
        return value;
2✔
40
    }
41

42
    /**
43
     * Converts the given object to a string.
44
     *
45
     * @param object the object to convert
46
     * @return the converted object
47
     */
48
    protected @NotNull String transformToString(@NotNull Object object) {
49
        return object.toString();
3✔
50
    }
51

52
    public ArrayPropertyType<String> arrayType() {
53
        return new ArrayPropertyType<>(this, String[]::new);
×
54
    }
55
}
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

© 2025 Coveralls, Inc