title: How to get all attributes definition by a specific object class in ldap?
body: <p>My aim is to retrieve all attributes defined on LDAP server by a given objectclass. What I have done so far is: </p>
  
  <pre><code>List&lt;SearchResult&gt; searchLdapUsers = searchLdapUsers(ldapConfig, null, null, null, null, null, 0);
  if (searchLdapUsers != null  &amp;&amp; searchLdapUsers.size() &gt; 0) {
      for (SearchResult searchResult : searchLdapUsers) {
          Attributes attrs = searchResult.getAttributes();
          if (attrs != null) {
              NamingEnumeration&lt;? extends Attribute&gt; all = attrs.getAll();
              while (all.hasMoreElements()) {
                  Attribute attribute = (Attribute) all.nextElement();
                  hs.put(attribute.getID(), attribute.getID());
              }
          }
      }
  }
  </code></pre>
  
  <p>This code will query all users from LDAP server and get attribute definition. This is working fine but will get problem with large number of users.</p>
  
  <p>Is there any other way to find directly the given object class and get all attribute definition inside?</p>