Class FilterExpressionParser
Provides a parser that can read a filter expression from a string and create an equivalent FilterExpression object.
The returned object can be serialized back into an equivalent string, which may not look exactly like the original input. That is because the parser normalizes the input, by surrounding field names and values with double quotes and by adding brackets.
Field names are case insensitive and so are string values.
Picklist values are case sensitive and the parser will throw an error if the expression contains a value not defined by the specified field.
Inheritance
Inherited Members
Namespace: Sdl.LanguagePlatform.TranslationMemory
Assembly: Sdl.LanguagePlatform.TranslationMemory.dll
Syntax
public class FilterExpressionParser
Constructors
FilterExpressionParser(IFieldDefinitions)
Initializes a new instance with a collection of field declarations.
Declaration
public FilterExpressionParser(IFieldDefinitions fieldDeclarations)
Parameters
Type | Name | Description |
---|---|---|
IFieldDefinitions | fieldDeclarations | The field declarations to use for parsing. |
Methods
Parse(String)
Parses a string expression and returns the equivalent FilterExpression object.
Declaration
public FilterExpression Parse(string s)
Parameters
Type | Name | Description |
---|---|---|
System.String | s | The input string. |
Returns
Type | Description |
---|---|
FilterExpression | The equivalent filter expression. If the string does not represent a valid expression, an exception is thrown. |
Parse(String, IFieldDefinitions)
Parses the provided expression
, using the provided field declarations,
and returns a FilterExpression which corresponds to the expression.
Declaration
public static FilterExpression Parse(string expression, IFieldDefinitions fieldDeclarations)
Parameters
Type | Name | Description |
---|---|---|
System.String | expression | The expression |
IFieldDefinitions | fieldDeclarations | The field declarations which are in effect, to resolve any field references |
Returns
Type | Description |
---|---|
FilterExpression | A filter expression. An exception is thrown if |