public TemplateAspect() : base("Mojo.Aspect")
 {
     //target all classes implementing ITemplate
     Targets.Add(new AspectTarget(typeof(ITemplate), AspectTargetType.Interface));
     //target all methods marked with FactoryMethodAttribute
     Pointcuts.Add(new AttributePointcut(typeof(FactoryMethodAttribute), new FactoryMethodInterceptor()));
 }
Example #2
0
 /// <summary>
 /// Signature aspect ctor.
 /// </summary>
 /// <param name="name">Name of the aspect.</param>
 /// <param name="targetName">Signature of the target type.</param>
 /// <param name="TargetMethodsignature">Signature of the target methods.</param>
 /// <param name="Interceptor">Single <c>IInterceptor</c> that should intercept the matched methods.</param>
 public SignatureAspect(string name, string targetName, string TargetMethodsignature, IInterceptor Interceptor)
 {
     Name = name;
     TargetTypeSignature = targetName;
     Pointcuts.Add(new SignaturePointcut(TargetMethodsignature, Interceptor));
 }
 /// <summary>
 /// Attribute aspect Ctor.
 /// </summary>
 /// <param name="Name">Name of the aspect.</param>
 /// <param name="attributeType">Type of the attribute to match</param>
 /// <param name="TargetMethodsignature">string Signature of methods to match.</param>
 /// <param name="Interceptor">Instance of an IInterceptor</param>
 public AttributeAspect(string Name, Type attributeType, string TargetMethodsignature, IInterceptor Interceptor)
 {
     this.Name     = Name;
     AttributeType = attributeType;
     Pointcuts.Add(new SignaturePointcut(TargetMethodsignature, Interceptor));
 }
Example #4
0
 /// <summary>
 /// Interface aspect Ctor.
 /// </summary>
 /// <param name="Name">Name of the aspect.</param>
 /// <param name="interfaceType">Type of the interface to match</param>
 /// <param name="TargetMethodsignature">string Signature of methods to match.</param>
 /// <param name="Interceptor">Instance of an IInterceptor</param>
 public InterfaceAspect(string Name, Type interfaceType, string TargetMethodsignature, IInterceptor Interceptor)
 {
     this.Name = Name;
     Pointcuts.Add(new SignaturePointcut(TargetMethodsignature, Interceptor));
     Targets.Add(new AspectTarget(interfaceType, AspectTargetType.Interface));
 }
 /// <summary>
 /// Signature aspect ctor.
 /// </summary>
 /// <param name="name">Name of the aspect</param>
 /// <param name="targetType">Specific Type to which the aspect should be applied.</param>
 /// <param name="targetMethodsignature">Signature of the target methods.</param>
 /// <param name="interceptor">Single <c>IInterceptor</c> that should intercept the matched methods.</param>
 public SignatureAspect(string name, Type targetType, string targetMethodsignature, IInterceptor interceptor)
 {
     Name = name;
     Pointcuts.Add(new SignaturePointcut(targetMethodsignature, interceptor));
     Targets.Add(new AspectTarget(targetType.FullName, AspectTargetType.Signature));
 }
Example #6
0
 /// <summary>
 /// Attribute aspect Ctor.
 /// </summary>
 /// <param name="Name">Name of the aspect.</param>
 /// <param name="attributeTypeName">Full name of the type of the attribute to match</param>
 /// <param name="TargetMethodsignature">string Signature of methods to match.</param>
 /// <param name="Interceptor">Instance of an IInterceptor</param>
 public AttributeAspect(string Name, string attributeTypeName, string TargetMethodsignature, IInterceptor Interceptor)
 {
     this.Name = Name;
     Pointcuts.Add(new SignaturePointcut(TargetMethodsignature, Interceptor));
     Targets.Add(new AspectTarget(attributeTypeName, AspectTargetType.Attribute));
 }