Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 320369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:44:50+00:00 2026-05-12T08:44:50+00:00

With relationship aspects implemented in AspectJ I can associate objects of two types in

  • 0

With relationship aspects implemented in AspectJ I can associate objects of two types in the following way (see code example below). I would like to transfer this concept to .net. Can you point me towards a .net weaver implementation that will allow me to do this or something similar?

Relationship aspects are designed by Pearce & Noble. Read more about the concept and implementation here: http://homepages.ecs.vuw.ac.nz/~djp/RAL/index.html

Im fairly new to AOP and my limited knowledge is obtained from playing around with AspectJ. I have identified that the design benefits from AspectJ’s capabilities of supporting intertype declarations and generic types, as well as being able to group weaving rules and advice within the unit of an “aspect”.

An example of associating Student and Course objects using a (simplified) relationship aspect:

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();
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T08:44:50+00:00Added an answer on May 12, 2026 at 8:44 am

    I’m not familiar with relationship aspects, but have you looked at PostSharp? It’s the top dog among aspect weavers for .NET. My guess is they support relationship aspects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 152k
  • Answers 152k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The managed debugging assistants in Visual Studio are designed for… May 12, 2026 at 10:11 am
  • Editorial Team
    Editorial Team added an answer The issue is resolved. The database-component (zeos) threw an exception… May 12, 2026 at 10:11 am
  • Editorial Team
    Editorial Team added an answer Well that happens because you are using an anonymous function.… May 12, 2026 at 10:11 am

Related Questions

After reading the Key-Value Coding Programming Guide , the Key-Value Observing Programming Guide and
The theory that disk is cheap has gotten a bit out of hand lately.
Question Alright, I'm confused by all the buzzwords and press release bingo going on.
Good afternoon, I am currently in the very early phase of a new project
I have two database one with relationship(no data) and another with out Relationship (with

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.