AspectJ에서 구현 된 관계 aspect를 사용하여 두 가지 유형의 객체를 다음과 같은 방식으로 연결할 수 있습니다 (아래 코드 예제 참조). 나는이 개념을 .net으로 옮기고 싶다. 내가 이것을 할 수있게 해주는 .net weaver 구현을 가리킬 수 있습니까?.Net 애스펙트 위버 지원 관계 aspect 구현
관계 측면은 Pearce가 디자인했습니다 & 귀족. 개념과 구현에 대한 자세한 내용은 여기를 참조하십시오. http://homepages.ecs.vuw.ac.nz/~djp/RAL/index.html
Im AOP의 새로운 기능으로, 제한된 지식은 AspectJ를 사용하여 얻은 것입니다. 나는 디자인이 AspectJ의 intertype 선언과 generic 타입을 지원하고, "aspect"의 단위 내에서 위빙 규칙과 조언을 그룹화 할 수 있다는 점에서 이점이 있음을 확인했다.
A (단순화) 관계의 측면을 사용하여 학생 및 코스 객체를 연결의 예 :
public class Course02 {
public String title;
public Course02(String title) {this.title = title; }
}
public class Student02 {
public String name;
public Student02(String name) {this.name = name; }
}
public aspect Attends02 extends SimpleStaticRel02<Student02, Course02> {}
public abstract aspect SimpleStaticRel02<FROM,TO>{
public static interface Fwd{}
public static interface Bwd{}
declare parents : FROM implements Fwd;
declare parents : TO implements Bwd;
final private HashSet Fwd.fwd = new HashSet();
final private HashSet Bwd.bwd = new HashSet();
public boolean add(FROM _f, TO _t) {
Fwd f = (Fwd) _f;
Bwd t = (Bwd) _t;
f.fwd.add(_t); // from adder to i fwd hashset
return t.bwd.add(_f); // to adder from i bwd hashset
}
public void printFwdCount(FROM _f)
{
Fwd f = (Fwd) _f;
System.out.println("Count forward is: " + f.fwd.size());
}
public void printBwdCount(TO _t)
{
Bwd b = (Bwd) _t;
System.out.println("Count backward is: " + b.bwd.size());
}
}
public class TestDriver {
public TestDriver() {
Course02 comp205 = new Course02("comp205");
Course02 comp206 = new Course02("comp206");
Student02 Joe = new Student02("Joe");
Student02 Andreas = new Student02("Andreas");
Attends02.aspectOf().add(Joe, comp205);
Attends02.aspectOf().add(Joe, comp206);
Attends02.aspectOf().printFwdCount(Andreas);
Attends02.aspectOf().printFwdCount(Joe);
Attends02.aspectOf().printBwdCount(comp206);
}
public static void main(String[] args) {
new TestDriver();
}
}
저는 PostSharp를 신속하게 살펴 보았지만 thourough는 보지 않았습니다. 많은 시간을 투자하기 전에 전문가의 추천을 받고 싶습니다. 관계 측면은 AspectJ의 기능이 아닙니다. Pearce + Noble이 디자인 한 AspectJ의 AOP 기능, 주로 inter-type 선언을 사용하는 클래스 라이브러리입니다. – DerDres