1. /*
  2. * @(#)HasControls.java 1.8 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.naming.ldap;
  8. import javax.naming.NamingException;
  9. /**
  10. * This interface is for returning controls with objects returned
  11. * in NamingEnumerations.
  12. * For example, suppose a server sends back controls with the results
  13. * of a search operation, the service provider would return a NamingEnumeration of
  14. * objects that are both SearchResult and implement HasControls.
  15. *<blockquote><pre>
  16. * NamingEnumeration elts = ectx.search((Name)name, filter, sctls);
  17. * while (elts.hasMore()) {
  18. * Object entry = elts.next();
  19. *
  20. * // Get search result
  21. * SearchResult res = (SearchResult)entry;
  22. * // do something with it
  23. *
  24. * // Get entry controls
  25. * if (entry instanceof HasControls) {
  26. * Control[] entryCtls = ((HasControls)entry).getControls();
  27. * // do something with controls
  28. * }
  29. * }
  30. *</pre></blockquote>
  31. *
  32. * @author Rosanna Lee
  33. * @author Scott Seligman
  34. * @author Vincent Ryan
  35. * @version 1.8 03/12/19
  36. * @since 1.3
  37. *
  38. */
  39. public interface HasControls {
  40. /**
  41. * Retrieves an array of <tt>Control</tt>s from the object that
  42. * implements this interface. It is null if there are no controls.
  43. *
  44. * @return A possibly null array of <tt>Control</tt> objects.
  45. * @throws NamingException If cannot return controls due to an error.
  46. */
  47. public Control[] getControls() throws NamingException;
  48. }