Class SSSOMTFormatFunction
java.lang.Object
org.incenp.obofoundry.sssom.transform.SSSOMTFormatFunction
- All Implemented Interfaces:
IFormatModifierFunction
Represents the SSSOM/T modifier function "format".
Use this function to apply an arbitrary formatting to a substituted value.
The function accepts a single parameter which should be a string containing a
single placeholder specification as accepted by Java’s
String.format(String, Object...) method. That placeholder will be
replaced by the substituted value.
For example, to format the value of the confidence slot (which
is of type Double):
"Confidence: %{confidence|format('%.03f')}"
If called on a list-typed value, the formatting will be applied to all elements of the list.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
SSSOMTFormatFunction
public SSSOMTFormatFunction()
-
-
Method Details
-
getName
Description copied from interface:IFormatModifierFunctionGets the name by which the function should be called in a placeholder.- Specified by:
getNamein interfaceIFormatModifierFunction- 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).- Specified by:
getSignaturein interfaceIFormatModifierFunction- Returns:
- The function signature.
-
call
Description copied from interface:IFormatModifierFunctionExecutes the function.- Specified by:
callin interfaceIFormatModifierFunction- Parameters:
value- The original value this function is supposed to modify. It is guaranteed never to benull, but the exact type will depend on what the substituted placeholder was, and also on what any previous modifier function may have done with it.extra- Additional arguments to the function, if any. If the function declared that it expects some mandatory arguments (through theIFormatModifierFunction.getSignature()method), it is guaranteed the list will contains as many arguments as expected.- Returns:
- The modified value. It may not need be of the same type as the original value (e.g., a function could transform a list value into a string value).
-