001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.commons.betwixt.io;
018
019
020 /** <p>Interface allowing pluggable <code>ID</code> attribute value generators.</p>
021 *
022 * <p> <code>IDGenerator</code>'s are used to generate <code>ID</code>
023 * attribute values by <code>BeanWriter</code>.
024 * A user can specify the generation mechanism by passing an implementation to
025 * {@link BeanWriter#setIdGenerator}.</p>
026 *
027 * <p>Standard implementations are included with that supply random and sequantial values.</p>
028 *
029 * @author <a href="mailto:rdonkin@apache.org">Robert Burrell Donkin</a>
030 * @version $Revision: 438373 $
031 */
032 public interface IDGenerator {
033
034 /**
035 * Get the last <code>ID</code> value generated.
036 *
037 * @return the last value generated
038 */
039 public String getLastId();
040
041 /**
042 * Generate a new <code>ID</code> attribute value.
043 *
044 * @return next value
045 */
046 public String nextId();
047 }