Table of Contents

Class FilterParser

Namespace
JsonApiDotNetCore.Queries.Parsing
Assembly
JsonApiDotNetCore.dll

Parses the JSON:API 'filter' query string parameter value.

[PublicAPI]
public class FilterParser : QueryExpressionParser, IFilterParser
Inheritance
FilterParser
Implements
Inherited Members

Constructors

FilterParser(IResourceFactory)

public FilterParser(IResourceFactory resourceFactory)

Parameters

resourceFactory IResourceFactory

Properties

ResourceTypeInScope

Gets the resource type currently in scope. Call InScopeOfResourceType(ResourceType) to temporarily change the current resource type.

protected ResourceType ResourceTypeInScope { get; }

Property Value

ResourceType

Methods

GetConstantValueConverterForType(Type)

protected virtual ConstantValueConverter GetConstantValueConverterForType(Type destinationType)

Parameters

destinationType Type

Returns

ConstantValueConverter

InScopeOfResourceType(ResourceType)

Changes the resource type currently in scope and restores the original resource type when the return value is disposed.

protected IDisposable InScopeOfResourceType(ResourceType resourceType)

Parameters

resourceType ResourceType

Returns

IDisposable

IsFunction(string)

protected virtual bool IsFunction(string name)

Parameters

name string

Returns

bool

Parse(string, ResourceType)

Parses the specified source into a FilterExpression. Throws a QueryParseException if the input is invalid.

public FilterExpression Parse(string source, ResourceType resourceType)

Parameters

source string

The source text to read from.

resourceType ResourceType

The resource type used to lookup JSON:API fields that are referenced in source.

Returns

FilterExpression

ParseAny()

protected virtual AnyExpression ParseAny()

Returns

AnyExpression

ParseComparison(string)

protected virtual ComparisonExpression ParseComparison(string operatorName)

Parameters

operatorName string

Returns

ComparisonExpression

ParseFilter()

protected virtual FilterExpression ParseFilter()

Returns

FilterExpression

ParseFunction()

protected virtual FunctionExpression ParseFunction()

Returns

FunctionExpression

ParseHas()

protected virtual HasExpression ParseHas()

Returns

HasExpression

ParseIsType()

protected virtual IsTypeExpression ParseIsType()

Returns

IsTypeExpression

ParseLogical(string)

protected virtual LogicalExpression ParseLogical(string operatorName)

Parameters

operatorName string

Returns

LogicalExpression

ParseNot()

protected virtual NotExpression ParseNot()

Returns

NotExpression

ParseTextMatch(string)

protected virtual MatchTextExpression ParseTextMatch(string operatorName)

Parameters

operatorName string

Returns

MatchTextExpression

ValidateField(ResourceFieldAttribute, int)

Enables derived types to throw a QueryParseException when usage of a JSON:API field inside a field chain is not permitted.

protected override void ValidateField(ResourceFieldAttribute field, int position)

Parameters

field ResourceFieldAttribute
position int