Package eu.europa.ted.efx.interfaces
Interface ScriptGenerator
-
- All Known Implementing Classes:
XPathScriptGenerator
public interface ScriptGenerator
-
-
Method Summary
-
-
-
Method Detail
-
composeNodeReferenceWithPredicate
<T extends Expression> T composeNodeReferenceWithPredicate(Expression.PathExpression nodeReference, Expression.BooleanExpression predicate, Class<T> type)
Given a PathExpression and a predicate, this method should return the target language script for matching the subset of nodes in the PathExpression that match the predicate. Similar tocomposeFieldReferenceWithPredicate(eu.europa.ted.efx.model.Expression.PathExpression, eu.europa.ted.efx.model.Expression.BooleanExpression, java.lang.Class<T>)but for nodes. Quick reminder: the difference between fields and nodes is that fields contain values, while nodes contain other nodes and/or fields.
-
composeFieldReferenceWithPredicate
<T extends Expression> T composeFieldReferenceWithPredicate(Expression.PathExpression fieldReference, Expression.BooleanExpression predicate, Class<T> type)
Given a PathExpression and a predicate, this method should return the target language script for matching the subset of nodes in the PathExpression that match the predicate. Similar tocomposeNodeReferenceWithPredicate(eu.europa.ted.efx.model.Expression.PathExpression, eu.europa.ted.efx.model.Expression.BooleanExpression, java.lang.Class<T>)but for fields. Quick reminder: the difference between fields and nodes is that fields contain values, while nodes contain other nodes and/or fields.
-
composeFieldValueReference
<T extends Expression> T composeFieldValueReference(Expression.PathExpression fieldReference, Class<T> type)
Given a PathExpression, this method should return the target language script for retrieving the value of the field.
-
composeFieldAttributeReference
<T extends Expression> T composeFieldAttributeReference(Expression.PathExpression fieldReference, String attribute, Class<T> type)
Given a PathExpression and an attribute name, this method should return the target language script for retrieving the value of the attribute.
-
composeVariableReference
<T extends Expression> T composeVariableReference(String variableName, Class<T> type)
Given a variable name this method should return script to dereference the variable. The returned Expression should be of the indicated type.
-
composeList
<T extends Expression,L extends Expression.ListExpression<T>> L composeList(List<T> list, Class<L> type)
Takes a list of string expressions and returns the target language script that corresponds to a list of string expressions.
-
getBooleanEquivalent
Expression.BooleanExpression getBooleanEquivalent(boolean value)
Takes a Java Boolean value and returns the corresponding target language script.
-
composeLogicalAnd
Expression.BooleanExpression composeLogicalAnd(Expression.BooleanExpression leftOperand, Expression.BooleanExpression rightOperand)
Returns the target language script for performing a logical AND operation on the two given operands.
-
composeLogicalOr
Expression.BooleanExpression composeLogicalOr(Expression.BooleanExpression leftOperand, Expression.BooleanExpression rightOperand)
Returns the target language script for performing a logical OR operation on the two given operands.
-
composeLogicalNot
Expression.BooleanExpression composeLogicalNot(Expression.BooleanExpression condition)
Returns the target language script for performing a logical NOT operation on the given boolean expression.
-
composeContainsCondition
<T extends Expression,L extends Expression.ListExpression<T>> Expression.BooleanExpression composeContainsCondition(T needle, L haystack)
Returns the target language script that checks whether a given list of values (haystack) contains a given value (needle).
-
composePatternMatchCondition
Expression.BooleanExpression composePatternMatchCondition(Expression.StringExpression expression, String regexPattern)
Returns the target language script that checks whether a given string matches the given RegEx pattern.
-
composeParenthesizedExpression
<T extends Expression> T composeParenthesizedExpression(T expression, Class<T> type)
Returns the given expression parenthesized in the target language.
-
composeAllSatisfy
<T extends Expression> Expression.BooleanExpression composeAllSatisfy(Expression.ListExpression<T> list, String variableName, Expression.BooleanExpression booleanExpression)
-
composeAnySatisfies
<T extends Expression> Expression.BooleanExpression composeAnySatisfies(Expression.ListExpression<T> list, String variableName, Expression.BooleanExpression booleanExpression)
-
composeConditionalExpression
<T extends Expression> T composeConditionalExpression(Expression.BooleanExpression condition, T whenTrue, T whenFalse, Class<T> type)
-
composeForExpression
<T1 extends Expression,L1 extends Expression.ListExpression<T1>,T2 extends Expression,L2 extends Expression.ListExpression<T2>> L2 composeForExpression(String variableName, L1 sourceList, T2 expression, Class<L2> targetListType)
-
composeExternalReference
Expression.PathExpression composeExternalReference(Expression.StringExpression externalReference)
TODO: Not properly defined yet. When we need data from an external source, we need some script that gets that data. Getting the data is a two-step process: a) we need to access the data source, b) we need to get the actual data from the data source. This method should return the target language script that connects to the data source and permits us to subsequently get the data by using a PathExpression.
-
composeFieldInExternalReference
Expression.PathExpression composeFieldInExternalReference(Expression.PathExpression externalReference, Expression.PathExpression fieldReference)
TODO: Not properly defined yet. SeecomposeExternalReference(eu.europa.ted.efx.model.Expression.StringExpression)for more details.
-
joinPaths
Expression.PathExpression joinPaths(Expression.PathExpression first, Expression.PathExpression second)
Joins two given path expressions into one by placing the second after the first and using the proper delimiter.- Parameters:
first- The part of the path that goes before the delimiter.second- The part of the path that goes after the delimiter.- Returns:
-
getStringLiteralFromUnquotedString
Expression.StringExpression getStringLiteralFromUnquotedString(String value)
Gets a piece of text and returns it inside quotes as expected by the target language.- Parameters:
value-- Returns:
-
composeComparisonOperation
Expression.BooleanExpression composeComparisonOperation(Expression leftOperand, String operator, Expression rightOperand)
Returns the target language script that compares the two operands (for equality etc.).- Parameters:
operator- The EFX operator that is used to compare the two operands. Do not forget to translate the operator to the target language equivalent.
-
composeNumericOperation
Expression.NumericExpression composeNumericOperation(Expression.NumericExpression leftOperand, String operator, Expression.NumericExpression rightOperand)
Given a numeric operation, this method should return the target language script that performs the operation.- Parameters:
operator- The EFX intended operator. Do not forget to translate the operator to the target language equivalent.
-
getNumericLiteralEquivalent
Expression.NumericExpression getNumericLiteralEquivalent(String efxLiteral)
Returns the numeric literal passed in target language script. The passed literal is in EFX.
-
getStringLiteralEquivalent
Expression.StringExpression getStringLiteralEquivalent(String efxLiteral)
Returns the string literal in the target language. Note that the string literal passed as a parameter is already between quotes in EFX.
-
getDateLiteralEquivalent
Expression.DateExpression getDateLiteralEquivalent(String efxLiteral)
-
getTimeLiteralEquivalent
Expression.TimeExpression getTimeLiteralEquivalent(String efxLiteral)
-
getDurationLiteralEquivalent
Expression.DurationExpression getDurationLiteralEquivalent(String efxLiteral)
-
composeCountOperation
Expression.NumericExpression composeCountOperation(Expression.PathExpression set)
Deprecated.Used only by SDK 0.6.x
-
composeCountOperation
Expression.NumericExpression composeCountOperation(Expression.ListExpressionBase list)
-
composeToNumberConversion
Expression.NumericExpression composeToNumberConversion(Expression.StringExpression text)
-
composeSumOperation
Expression.NumericExpression composeSumOperation(Expression.PathExpression set)
Deprecated.Used only by SDK 0.6.x
-
composeSumOperation
Expression.NumericExpression composeSumOperation(Expression.NumericListExpression list)
-
composeStringLengthCalculation
Expression.NumericExpression composeStringLengthCalculation(Expression.StringExpression text)
-
composeStringConcatenation
Expression.StringExpression composeStringConcatenation(List<Expression.StringExpression> list)
-
composeEndsWithCondition
Expression.BooleanExpression composeEndsWithCondition(Expression.StringExpression text, Expression.StringExpression endsWith)
-
composeStartsWithCondition
Expression.BooleanExpression composeStartsWithCondition(Expression.StringExpression text, Expression.StringExpression startsWith)
-
composeContainsCondition
Expression.BooleanExpression composeContainsCondition(Expression.StringExpression haystack, Expression.StringExpression needle)
-
composeSubstringExtraction
Expression.StringExpression composeSubstringExtraction(Expression.StringExpression text, Expression.NumericExpression start)
-
composeSubstringExtraction
Expression.StringExpression composeSubstringExtraction(Expression.StringExpression text, Expression.NumericExpression start, Expression.NumericExpression length)
-
composeToStringConversion
Expression.StringExpression composeToStringConversion(Expression.NumericExpression number)
-
composeExistsCondition
Expression.BooleanExpression composeExistsCondition(Expression.PathExpression reference)
-
composeToDateConversion
Expression.DateExpression composeToDateConversion(Expression.StringExpression pop)
-
composeAddition
Expression.DateExpression composeAddition(Expression.DateExpression date, Expression.DurationExpression duration)
-
composeSubtraction
Expression.DateExpression composeSubtraction(Expression.DateExpression date, Expression.DurationExpression duration)
-
composeToTimeConversion
Expression.TimeExpression composeToTimeConversion(Expression.StringExpression pop)
-
composeToDayTimeDurationConversion
Expression.DurationExpression composeToDayTimeDurationConversion(Expression.StringExpression text)
-
composeToYearMonthDurationConversion
Expression.DurationExpression composeToYearMonthDurationConversion(Expression.StringExpression text)
-
composeSubtraction
Expression.DurationExpression composeSubtraction(Expression.DateExpression startDate, Expression.DateExpression endDate)
-
composeNumberFormatting
Expression.StringExpression composeNumberFormatting(Expression.NumericExpression number, Expression.StringExpression format)
-
composeMultiplication
Expression.DurationExpression composeMultiplication(Expression.NumericExpression number, Expression.DurationExpression duration)
-
composeAddition
Expression.DurationExpression composeAddition(Expression.DurationExpression left, Expression.DurationExpression right)
-
composeSubtraction
Expression.DurationExpression composeSubtraction(Expression.DurationExpression left, Expression.DurationExpression right)
-
-