title: How to retrieve attributes from a classDeclaration with reflection
body: <p>I want to create a custom attribute that will be applied to classDeclarations.  I can enumerate attributes from other methods on the class, but not the classDeclaration itself because it is some sort of <em>special method</em>.</p>
  
  <p>I know it is possible though because SysObsoleteAttribute (called from the kernel) is placed in classDeclarations all over.</p>
  
  <p>In <code>Classes\CustCustomerService\create</code> I just copied the attributes to <code>Classes\CustCustomerService\classDeclaration</code> at the top for this test.</p>
  
  <pre><code>[AifDocumentCreateAttribute, SysEntryPointAttribute(true)]
  class CustCustomerService extends AifDocumentService
  {
  
  }
  </code></pre>
  
  <p>I created a static method on a new class:</p>
  
  <pre><code>static public void AttribsOfSysEntryPointAttributeOnMethod
              (
              str _sNameOfClass,
              str _sNameOfMethod,
              str _nameOfAttribute
              )
  {
      int nClassId;
  
      SysDictMethod       sdm;
      Object attributeAsObject;
      SysDictClass            sysDictClass;
  
      Array                   attribArray = new Array(Types::Class);
      int i;
  
      nClassId = Global::className2Id(_sNameOfClass);
  
      sysDictClass    = new SysDictClass(nClassId);
  
      sdm = new SysDictMethod(UtilElementType::ClassInstanceMethod, nClassId, _sNameOfMethod);
  
      attribArray = sdm.getAllAttributes();
  
      if (attribArray)
      {
          for (i=1; i&lt;=attribArray.lastIndex(); i++)
          {
              attributeAsObject = attribArray.value(i);
  
              info(strFmt("[%3] Attrib Class Id: %1 [%2]", classIdGet(attributeAsObject), classId2Name(classIdGet(attributeAsObject)), _sNameOfMethod));
  
          }
      }
      else
      {
          // Unable to get attributes, try another way
          error(strFmt("Unable to retrieve attribute array for method %1", sdm.name()));
  
          // It is, so let's try and enumerate ALL attributes and output them directly from class dec
          sdm = sysDictClass.objectMethodObject(1);
  
          if (attribArray)
          {
              for (i=1; i&lt;=attribArray.lastIndex(); i++)
              {
                  attributeAsObject = attribArray.value(i);
  
                  info(strFmt("[%3] Attrib Class Id: %1 [%2]", classIdGet(attributeAsObject), classId2Name(classIdGet(attributeAsObject)), _sNameOfMethod));
  
              }
          }
          else
              error(strFmt("Still unable to retrieve attribute array for method %1", sysDictClass.objectMethod(1)));
      }
  }
  </code></pre>
  
  <p>Then created a job to call it, and you can see how it works for one method, but not the other.</p>
  
  <pre><code>static void Job5(Args _args)
  {        
      AttributeReflection::AttribsOfSysEntryPointAttributeOnMethod("CustCustomerService", "create", "SysEntryPointAttribute");
      AttributeReflection::AttribsOfSysEntryPointAttributeOnMethod("CustCustomerService", "classDeclaration", "SysEntryPointAttribute");
  
  }
  </code></pre>
  
  <p>Any ideas how to enumerate Attributes from the classDeclaration??</p>