title: java: standard interface with getName() method?
body: <p>Is there a standard Java interface with a <code>getName()</code> method that returns a string? I keep finding I have to make my own:</p>
  
  <pre><code>/** objects which know their own names, 
   *  e.g. that are indexed in a Map by their name
   */
  interface NamedObject
  {
     public String getName()
  }
  </code></pre>
  
  <p>but I'd much rather use a standard one if it's out there.</p>
  
  <hr>
  
  <p>edit for an example -- which I think is somewhat of a red herring to my question, so I specifically do <strong>not</strong> want answers suggesting alternatives that are specific to the following situation. (I've run into the need for a <code>NamedObject</code> interface several times, so I was hoping it was something in a standard library.)</p>
  
  <p>But since you asked for some background context, here it is:</p>
  
  <pre><code>@Override public void stateChanged(ChangeEvent e) {
      Object obj = e.getSource();             
      if (obj instanceof NamedObject)
      {
          String name = ((NamedObject)obj).getName();
          /* do something based on object's name */
      }
  }
  </code></pre>
  
  <p>In my current project, I have a system with three elements: a source, a transmission method, and a receiver. I want to get some information from the source to a receiver, and I control the implementation of both. The transmission method unfortunately is stuck using an object that supports ChangeListener, so all the receiver gets a <code>ChangeEvent</code> with which I can get a source object.</p>
  
  <p>So I have to use implied shared semantics between my source and receiver, i.e. there's a shared understanding that the source object passed in the ChangeEvent is of class X, where I can pick class X. In this case, all I really care about is the name, from which I can get additional data. I can define my own interface, I was just hoping to be able to use a standard interface since the source and receiver are in different .jar files...</p>