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

AuthMe / ConfigMe / 11195997843

05 Oct 2024 08:11PM UTC coverage: 99.411%. Remained the same
11195997843

Pull #444

github

ljacqu
Move channel declaration
Pull Request #444: #442 Update Checkstyle version used by CodeClimate

528 of 540 branches covered (97.78%)

1520 of 1529 relevant lines covered (99.41%)

4.58 hits per line

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

100.0
/src/main/java/ch/jalu/configme/beanmapper/leafvaluehandler/LeafValueHandler.java
1
package ch.jalu.configme.beanmapper.leafvaluehandler;
2

3
import ch.jalu.configme.beanmapper.context.ExportContext;
4
import ch.jalu.configme.beanmapper.context.MappingContext;
5
import org.jetbrains.annotations.NotNull;
6
import org.jetbrains.annotations.Nullable;
7

8
/**
9
 * The leaf value handler is used in {@link ch.jalu.configme.beanmapper.MapperImpl} to convert "simple" values that
10
 * were read from a resource to its desired type.
11
 * <p>
12
 * The bean mapper handles complex types such as maps and collections, and recursively calls the bean mapping process
13
 * accordingly. This class complements the mapper by halting this process and providing "leaf values" to be set into
14
 * Java beans.
15
 * <p>
16
 * The default implementation is {@link LeafValueHandlerImpl}. With the aid of {@link MapperLeafType} entries, it
17
 * provides conversions for the leaf types it supports. To implement additional conversions, implement your own
18
 * {@link MapperLeafType} implementations and add them to {@link LeafValueHandlerImpl}. Alternatively, you can create
19
 * your own implementation of this interface if you need more control over the conversion process.
20
 */
21
public interface LeafValueHandler {
22

23
    /**
24
     * Converts the given value to the target type (as defined by the mapping context), if supported. Otherwise,
25
     * null is returned. If a value is returned, its type is guaranteed to match the target type.
26
     *
27
     * @param value the value to convert (read from a property resource)
28
     * @param mappingContext mapping context with the target type
29
     * @return the converted value, or null if not applicable
30
     */
31
    @Nullable Object convert(@Nullable Object value, @NotNull MappingContext mappingContext);
32

33
    /**
34
     * Converts the value of a property to a value suitable for exporting. This method converts the opposite
35
     * way of {@link #convert}. Null is returned if this leaf value handler does not support the object's type.
36
     *
37
     * @param value the value to convert
38
     * @param exportContext the export context (usually not needed)
39
     * @return the value suitable for exporting, or null if not applicable
40
     */
41
    @Nullable Object toExportValue(@Nullable Object value, @NotNull ExportContext exportContext);
42

43
}
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