io.virtdata.libbasics.shared.unary_string.Prefix Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of virtdata-lib-realer Show documentation
Show all versions of virtdata-lib-realer Show documentation
With inspiration from other libraries
package io.virtdata.libbasics.shared.unary_string;
import io.virtdata.annotations.Example;
import io.virtdata.annotations.ThreadSafeMapper;
import java.util.function.Function;
/**
* Add the specified prefix String to the input value and return the result.
*/
@ThreadSafeMapper
public class Prefix implements Function{
private String prefix;
@Example({"Prefix('PREFIX:')", "Prepend 'PREFIX:' to every input value"})
public Prefix(String prefix){
this.prefix = prefix;
}
@Override
public String apply(String s) {
return prefix + s;
}
}