<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <div class="moz-cite-prefix">On 2/6/14 8:51 PM, Brent Putman wrote:<br>
    </div>
    <blockquote cite="mid:52F43C1A.9010608@georgetown.edu" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      <br>
      <div class="moz-cite-prefix">On 2/6/14 8:41 PM, Brent Putman
        wrote:<br>
      </div>
      <blockquote cite="mid:52F439E6.9050101@georgetown.edu" type="cite">
        <meta content="text/html; charset=ISO-8859-1"
          http-equiv="Content-Type">
        <br>
        I think that's done pretty easily automagically with a
        BeanPostProcessor that does something like:<br>
        <br>
        <meta http-equiv="content-type" content="text/html;
          charset=ISO-8859-1">
        <tt>Object postProcessBeforeInitialization(Object bean, String
          beanName) throws BeansException {</tt><tt><br>
        </tt><tt>&nbsp; if (bean instanceof </tt><tt>IdentifiableComponent)
          {</tt><tt><br>
        </tt><tt>&nbsp;&nbsp;&nbsp; ((IdentifiableComponent)bean).setID(beanName);</tt><tt><br>
        </tt><tt>&nbsp; }</tt><tt><br>
        </tt><tt>}</tt><br>
        <blockquote
cite="mid:CAMNmQDRU0c9jTpGHT7D9GMg0BBUBtko74vuKzrj40YoNgQR3dg@mail.gmail.com"
          type="cite"> </blockquote>
        <br>
      </blockquote>
      <br>
      Actually, looks like that interface doesn' define a setID method,
      and even the abstract impls I see in java-support currently expose
      it as a protected method, not public.&nbsp; I can't look at any of our
      concrete impls until I get back to a working Eclipse workspace, so
      I don't know if any of them actually expose this in a useful way
      (probably not).</blockquote>
    <br>
    Yeah, not seeing any candiates for this as far as public methods.&nbsp;
    I'd say that if this is important enough, you'd either have to put a
    public setId(..) on the IdentifiableComponent interface (which may
    not really in general be a good idea), or else rely on the fact that
    the private variable is usually/always named 'id' and set it via
    reflection or something.<br>
    <br>
    Which reminds me: The latter (reflection) sounds somewhat horrible
    and it is.&nbsp; However, on a related note, because Spring sets
    properties via reflection, it actually does this routinely.&nbsp;
    Recently in another project I discovered I was mistakenly creating
    an XML wired bean via invokation of a protected (or private?)
    constructor on something.&nbsp; And you probably know that with their
    annotation support you can @Autowired a private variable which
    doesn't even have a getter/setter.&nbsp; So maybe it isn't that crazy....
    as long as we standardize on 'id' as the class variable name.<br>
    <br>
    <br>
    <br>
    <br>
  </body>
</html>