1. /*
  2. * Copyright 2001-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.apache.commons.betwixt.io;
  17. /** <p>Interface allowing pluggable <code>ID</code> attribute value generators.</p>
  18. *
  19. * <p> <code>IDGenerator</code>'s are used to generate <code>ID</code>
  20. * attribute values by <code>BeanWriter</code>.
  21. * A user can specify the generation mechanism by passing an implementation to
  22. * {@link BeanWriter#setIdGenerator}.</p>
  23. *
  24. * <p>Standard implementations are included with that supply random and sequantial values.</p>
  25. *
  26. * @author <a href="mailto:rdonkin@apache.org">Robert Burrell Donkin</a>
  27. * @version $Revision: 1.7 $
  28. */
  29. public interface IDGenerator {
  30. /**
  31. * Get the last <code>ID</code> value generated.
  32. *
  33. * @return the last value generated
  34. */
  35. public String getLastId();
  36. /**
  37. * Generate a new <code>ID</code> attribute value.
  38. *
  39. * @return next value
  40. */
  41. public String nextId();
  42. }