OpenAPI.NET.OData/src/Microsoft.OpenApi.OData.Reader/PathItem/PathItemHandlerProvider.cs
Vincent Biret 960b31b350
- code linting
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
2021-11-22 14:42:37 -05:00

59 lines
1.9 KiB
C#

// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// ------------------------------------------------------------
using System.Collections.Generic;
using Microsoft.OpenApi.OData.Edm;
namespace Microsoft.OpenApi.OData.PathItem
{
/// <summary>
/// Default path item handler provider.
/// </summary>
internal class PathItemHandlerProvider : IPathItemHandlerProvider
{
private readonly IDictionary<ODataPathKind, IPathItemHandler> _handlers = new Dictionary<ODataPathKind, IPathItemHandler>
{
// EntitySet
{ ODataPathKind.EntitySet, new EntitySetPathItemHandler() },
// Entity
{ ODataPathKind.Entity, new EntityPathItemHandler() },
// Singleton
{ ODataPathKind.Singleton, new SingletonPathItemHandler() },
// Navigation property
{ ODataPathKind.NavigationProperty, new NavigationPropertyPathItemHandler() },
// Edm Operation
{ ODataPathKind.Operation, new OperationPathItemHandler() },
// Edm OperationImport
{ ODataPathKind.OperationImport, new OperationImportPathItemHandler() },
// Edm Ref
{ ODataPathKind.Ref, new RefPathItemHandler() },
// Media Entity
{ ODataPathKind.MediaEntity, new MediaEntityPathItemHandler() },
// $Metadata
{ ODataPathKind.Metadata, new MetadataPathItemHandler() },
// $count
{ ODataPathKind.DollarCount, new DollarCountPathItemHandler() },
// Unknown
{ ODataPathKind.Unknown, null },
};
/// <inheritdoc/>
public IPathItemHandler GetHandler(ODataPathKind pathKind)
{
return _handlers[pathKind];
}
}
}