Class SystemDataTools
- java.lang.Object
-
- de.aristaflow.adept2.model.common.systemdata.SystemDataTools
-
public final class SystemDataTools extends Object
This utility class provides methods to deal withparameter references
in the strings returned bySystemDataConsumer
annotated methods.- Author:
- Patrick Schmidt
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ParameterRef[]
findParameterReferences(String parameterisedString)
Finds all parameter references (seeSystemDataConsumer
) in the given string and returns them.static ParameterRefParser
getParser(String parameterisedString)
Returns a parser for the specified parameterised string.static ParameterRefReplacer
getReplacer(String parameterisedString)
Returns a replacer for the specified parameterised string to replace parameter references with actual values.static boolean
isCompatibleParameter(ParameterRef paramRef, Parameter parameter)
Returns true, if the parameter reference and the given parameter are compatible.static ParameterRef
parseParameterReference(String parameterReference)
Parses the specified string representation of a parameter reference (including the enclosing '%'s) and returns it as aParameterRef
object (ornull
if the reference is in any way illegal).
-
-
-
Method Detail
-
findParameterReferences
public static ParameterRef[] findParameterReferences(String parameterisedString)
Finds all parameter references (seeSystemDataConsumer
) in the given string and returns them. This method will avoid returning duplicates (i.e. two parameter references that exactly match in name and type).This method will only recognise parameter references with data types that are supported by system/node parameters (INTEGER, FLOAT and STRING).
- Parameters:
parameterisedString
- a string, potentially containing variables / parameter references- Returns:
- all parameter references found in the string
-
parseParameterReference
public static ParameterRef parseParameterReference(String parameterReference)
Parses the specified string representation of a parameter reference (including the enclosing '%'s) and returns it as aParameterRef
object (ornull
if the reference is in any way illegal).This method will only recognise parameter references with data types that are supported by system/node parameters (INTEGER, FLOAT and STRING).
- Parameters:
parameterReference
- string representation of a parameter reference- Returns:
- a parsed
ParameterRef
object ornull
if the reference is in any way illegal
-
getParser
public static ParameterRefParser getParser(String parameterisedString)
Returns a parser for the specified parameterised string. The advantage compared tofindParameterReferences(String)
is that the parser provides position information (start and end index of parameter reference).This method will only recognise parameter references with data types that are supported by system/node parameters (INTEGER, FLOAT and STRING).
- Parameters:
parameterisedString
- the parameterised string to be formatted- Returns:
- a formatter for the specified parameterised string
-
getReplacer
public static ParameterRefReplacer getReplacer(String parameterisedString)
Returns a replacer for the specified parameterised string to replace parameter references with actual values.This method will only recognise parameter references with data types that are supported by system/node parameters (INTEGER, FLOAT and STRING).
- Parameters:
parameterisedString
- the parameterised string to be processed- Returns:
- a replacer for the specified parameterised string
-
isCompatibleParameter
public static boolean isCompatibleParameter(ParameterRef paramRef, Parameter parameter)
Returns true, if the parameter reference and the given parameter are compatible.- Parameters:
paramRef
- Parameter reference.parameter
- Real parameter.- Returns:
- True, if the parameter reference and the given parameter are compatible.
-
-