public interface Charger
In more general terms, all target instances can be filled with values via reflection if they have suitable methods for receiving these values: so-called setters**. Within certain limits, this can also apply, for example, to target instances according to the builder pattern.
The producer class that implements this interface must provide appropriate getters*** to supply the values that can be passed to the target instance's setters.
Static, synthetic and native methods are generally ignored.
*Classic Java data objects in this context means objects that are (essentially) made up of properties and whose property values can be determined or set using so-called getters and setters**.
**Setters in this context are public instance methods that take exactly one argument as a parameter and return nothing (void) or, according to the builder pattern, the target instance itself as the result.
***Getters in this context are public instance methods that take no parameters and return a result
of a specific type (not void). The hashCode() and toString()
methods are ignored.
package| Modifier and Type | Method and Description |
|---|---|
default <T> T |
charge(T target,
String... ignore)
Initializes the properties of a given
target instance with values provided by this Charger instance
itself and returns the initialized target. |
default <T> T charge(T target,
String... ignore)
target instance with values provided by this Charger instance
itself and returns the initialized target.
In order for a property to be initialized, the target's class must provide a corresponding setter
that is actually accessible from this Charger. In addition, this Charger's implementation class
must provide a parameterless method that can return an appropriate value for the property in question.
The default implementation provides the intended functionality. It makes little sense to override this method or then even use this interface at all.
T - The target type.target - The target of the operation.ignore - The names of methods that shell be ignored.Copyright © 2023 Andreas Kluge-Kaindl, Bremen (de). All rights reserved.