get event name????

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

    #1

    get event name????

    I have component X that writes xml and gets name and value from components
    Y,Z.

    since cmponents Y,Z are the same but with idfferent name when i try to catch
    their name with source

    evt.getSource() .getClass().get CanonicalName() ;

    I get the same name.

    How do i get the name of every component?



  • Ian Shef

    #2
    Re: get event name????

    "sight" <bljak@bljak.sp am> wrote in news:ds0u58$e43 $1@bagan.srce.h r:
    [color=blue]
    > I have component X that writes xml and gets name and value from
    > components Y,Z.
    >
    > since cmponents Y,Z are the same but with idfferent name when i try to
    > catch their name with source
    >
    > evt.getSource() .getClass().get CanonicalName() ;
    >
    > I get the same name.
    >
    > How do i get the name of every component?[/color]

    I think that by "component" you mean "instance of an object".
    I think that by "name" you mean "an object's unique identifier".
    If this is what you meant, I think that you are out of luck. In Java,
    objects don't have unique identifiers unless they are designed and
    implemented that way.

    Sometimes, hashCode() and toString() are of some use, but they are NOT
    guaranteed to be unique.

    You may want to rethink what you are trying to accomplish, and how you are
    trying to accomplish it.

    On the other hand, your object X is certainly entitled to keep its own list
    of objects (say, a java.util.Hasht able) and to provide its own "name" for
    each new instance as it is encountered.


    --
    Ian Shef 805/F6 * These are my personal opinions
    Raytheon Company * and not those of my employer.
    PO Box 11337 *
    Tucson, AZ 85734-1337 *

    Comment

    Working...