jellyfin/MediaBrowser.Controller/Resolvers/ItemResolver.cs
Cody Robibero d461e3912a
Remove warninigs from MediaBrowser.Controller (Part 3) (#6078)
Co-authored-by: Bond-009 <bond.009@outlook.com>
2021-06-06 17:16:41 +02:00

58 lines
1.5 KiB
C#

#nullable disable
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
namespace MediaBrowser.Controller.Resolvers
{
/// <summary>
/// Class ItemResolver.
/// </summary>
/// <typeparam name="T">The type of BaseItem.</typeparam>
public abstract class ItemResolver<T> : IItemResolver
where T : BaseItem, new()
{
/// <summary>
/// Gets the priority.
/// </summary>
/// <value>The priority.</value>
public virtual ResolverPriority Priority => ResolverPriority.First;
/// <summary>
/// Resolves the specified args.
/// </summary>
/// <param name="args">The args.</param>
/// <returns>`0.</returns>
public virtual T Resolve(ItemResolveArgs args)
{
return null;
}
/// <summary>
/// Sets initial values on the newly resolved item.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="args">The args.</param>
protected virtual void SetInitialItemValues(T item, ItemResolveArgs args)
{
}
/// <summary>
/// Resolves the path.
/// </summary>
/// <param name="args">The args.</param>
/// <returns>BaseItem.</returns>
BaseItem IItemResolver.ResolvePath(ItemResolveArgs args)
{
var item = Resolve(args);
if (item != null)
{
SetInitialItemValues(item, args);
}
return item;
}
}
}