Determine if an object is accessible from another object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Robert Schneider

    #1

    Determine if an object is accessible from another object

    I would like to find out if an object A is accessible from object B. But
    consider indirections as well. So object B might access oject C and object C
    references object D through a collection (what would actually be object E)
    that finally references object A.

    Do you know of any simple and dynamic/scalable solution? Since the classes
    with which the solution works could get more. Then the solution should work
    without any changes.

    Another wish (task) is that I would like to know which objects uses object
    A. I assume that I start from one object for the search. I think this task
    could be merged with the first mentioned one.

    I guess reflection is the appropiate means. But I'm not sure if the solution
    gets simple or complex. I may oversee some issues. I think I would have to
    go through the fields of a class recursively and check if the object
    references the other object that I'm searching for. But is this sufficient?
    Or does this solution lacks anything?

    Assume that all object does not have circular references. But it would be
    interesting to know how this could get accomplished.

    Greetings,
    Robert


    --
    e-mail: r_.s_chnei_der\ wein_gart_ner.c om (remove all '_' and replace '\'
    with
    '@')

Working...