Class SimpleStringModifierFunction
java.lang.Object
org.incenp.obofoundry.sssom.transform.BaseStringModifierFunction
org.incenp.obofoundry.sssom.transform.SimpleStringModifierFunction
- All Implemented Interfaces:
IFormatModifierFunction
Represents a simple format modifier function that does not take any argument.
This class is intended to allow creating simple modifiers without having to create a new dedicated class. For example, to create a modifier that turns its input into lowercase:
new SimpleStringModifierFunction("lower", (input) -> input.toLowerCase());
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleStringModifierFunction(String name, Function<String, String> func) Creates a new instance. -
Method Summary
Methods inherited from class org.incenp.obofoundry.sssom.transform.BaseStringModifierFunction
call
-
Constructor Details
-
SimpleStringModifierFunction
Creates a new instance.- Parameters:
name- The name of the modifier function to create.func- The implementation of the function.
-
-
Method Details
-
getName
Description copied from interface:IFormatModifierFunctionGets the name by which the function should be called in a placeholder.- Returns:
- The function name.
-
getSignature
Description copied from interface:IFormatModifierFunctionGets the expected signature of the function. This works similarly toISSSOMTFunction.getSignature(), but it only concerns the additional arguments beyond the value of the substituted placeholder to modify (e.g.extra_arg1in the example above).- Returns:
- The function signature.
-
apply
Description copied from class:BaseStringModifierFunctionApplies the function to a single value.- Specified by:
applyin classBaseStringModifierFunction- Parameters:
value- The value to apply the function to.extra- Arguments to the function, if any.- Returns:
- The modified value.
-