Class SimpleStringModifierFunction
- java.lang.Object
-
- org.incenp.obofoundry.sssom.transform.BaseStringModifierFunction
-
- org.incenp.obofoundry.sssom.transform.SimpleStringModifierFunction
-
- All Implemented Interfaces:
IFormatModifierFunction
public class SimpleStringModifierFunction extends BaseStringModifierFunction
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
Constructors Constructor Description SimpleStringModifierFunction(String name, Function<String,String> func)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Stringapply(Object value, List<String> extra)Applies the function to a single value.StringgetName()Gets the name by which the function should be called in a placeholder.StringgetSignature()Gets the expected signature of the function.-
Methods inherited from class org.incenp.obofoundry.sssom.transform.BaseStringModifierFunction
call
-
-
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:IFormatModifierFunctionGets the name by which the function should be called in a placeholder.- Returns:
- The function name.
-
getSignature
public String 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
protected String apply(Object value, List<String> extra)
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.
-
-