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 18 19 /** <p>Interface allowing pluggable <code>ID</code> attribute value generators.</p> 20 * 21 * <p> <code>IDGenerator</code>'s are used to generate <code>ID</code> 22 * attribute values by <code>BeanWriter</code>. 23 * A user can specify the generation mechanism by passing an implementation to 24 * {@link BeanWriter#setIdGenerator}.</p> 25 * 26 * <p>Standard implementations are included with that supply random and sequantial values.</p> 27 * 28 * @author <a HREF="mailto:rdonkin@apache.org">Robert Burrell Donkin</a> 29 * @version $Revision: 1.7 $ 30 */ 31 public interface IDGenerator { 32 33 /** 34 * Get the last <code>ID</code> value generated. 35 * 36 * @return the last value generated 37 */ 38 public String getLastId(); 39 40 /** 41 * Generate a new <code>ID</code> attribute value. 42 * 43 * @return next value 44 */ 45 public String nextId(); 46 } 47