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