![JAR search and dependency download from the Maven repository](/logo.png)
org.klojang.invoke.BeanValueTransformer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of klojang-invoke Show documentation
Show all versions of klojang-invoke Show documentation
Klojang Invoke is a Java module focused on path-based object access and dynamic
invocation. Its central classes are the Path class and the PathWalker class. The
Path class captures a path through an object graph. For example
"employee.address.city". The PathWalker class lets you read from and write to
a wide variety of types using Path objects.
package org.klojang.invoke;
/**
* A {@code BeanValueTransformer} can be "inserted" into a {@link BeanReader} and
* {@link BeanWriter} to modify the value to be returned to the user by the
* {@code BeanReader}, or to be written to the bean by the {@code BeanWriter}.
*
* @param the type of the bean
*/
@FunctionalInterface
public interface BeanValueTransformer {
/**
* The no-op transformer. Returns the property value as-is.
*
* @param the type of the bean
* @return the property value as-is
*/
static BeanValueTransformer identity() { return (x, y, z) -> z; }
/**
* Transforms the value just retrieved from a bean, or about to be set on a bean.
*
* @param bean the bean that was read or is about to be written
* @param propertyName the name of the property that was read or is about to be
* written
* @param propertyValue the original value
* @return the new value
*/
Object transform(T bean, String propertyName, Object propertyValue);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy