using System;
namespace Capnp.Rpc
{
///
/// Annotates a capability interface with its Skeleton implementation.
///
[AttributeUsage(AttributeTargets.Interface, AllowMultiple = false, Inherited = true)]
public class SkeletonAttribute: Attribute
{
///
/// Constructs this attribute.
///
/// Skeleton type. This must be a class which inherits from and
/// exposes a public parameterless constructor. Moreover, it must have same amount of generic type
/// parameters like the annotated interface, with identical generic constraints.
/// is null.
public SkeletonAttribute(Type skeletonClass)
{
if (skeletonClass == null)
throw new ArgumentNullException(nameof(skeletonClass));
if (!typeof(Skeleton).IsAssignableFrom(skeletonClass))
throw new ArgumentException("Must inherit from Skeleton");
SkeletonClass = skeletonClass;
}
///
/// Gets the skeleton type.
///
public Type SkeletonClass { get; }
}
}